Skip to content

Instantly share code, notes, and snippets.

@saitgulmez
Created September 26, 2022 16:35
Show Gist options
  • Select an option

  • Save saitgulmez/ab13990310802866f431b3e78a165797 to your computer and use it in GitHub Desktop.

Select an option

Save saitgulmez/ab13990310802866f431b3e78a165797 to your computer and use it in GitHub Desktop.
require 'blake2b'
input = "020e0000006361737065722d6578616d706c65130000006578616d706c652d656e7472792d706f696e7401000000080000007175616e7469747904000000e803000001050100000006000000616d6f756e7404000000e803000001"
key = Blake2b::Key.none
hex = Blake2b.hex(input, key, 32) # It does not give the same result that we got from js
body_uint8_array = [input].pack("H*").unpack("C*").inspect
body_hash_array = Blake2b.bytes(body_uint8_array, key, 32)
puts body_hash_array.pack("C*").unpack("H*").first
# puts body_uint8_array.size
# puts body_uint8_array.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment