To create a BLAKE2b hash from a string in Ruby, you can use the blake2b gem.
First, you will need to install the gem by adding gem 'blake2b' to your Gemfile and running bundle install or by running gem install blake2b in your terminal.
Once you have the gem installed, you can use the following code to create a BLAKE2b hash from a string:
main.rb366 chars15 linesThis will output:
main.rb173 chars2 lines
In the code above, the Blake2b::Digest.new(64) line creates a new BLAKE2b hash object with a digest length of 64 bytes. The update function updates the hash object with the string you want to hash, and the hexdigest function gets the final hash as a hexadecimal string.
gistlibby LogSnag