import os
import blake2

# Test the BLAKE2b implementation
proc testBlake2b() =
  # Create a test file
  let testFile = "test_file.txt"
  writeFile(testFile, "Hello, NexusOS!")

  # Calculate BLAKE2b hash using our implementation
  var ctx: Blake2b
  blake2b_init(ctx, 32) # 32 bytes = 256 bits
  let fileContent = readFile(testFile)
  blake2b_update(ctx, fileContent, fileContent.len)
  let hash = blake2b_final(ctx)
  let hashStr = "blake2b-" & $hash

  echo "Test file content: ", fileContent
  echo "BLAKE2b hash: ", hashStr
  echo "Hash length: ", hashStr.len

  # Clean up
  removeFile(testFile)

when isMainModule:
  testBlake2b()
