summaryrefslogtreecommitdiff
path: root/lib/srp/util.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/srp/util.rb')
-rw-r--r--lib/srp/util.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/srp/util.rb b/lib/srp/util.rb
index 6792105..0da1f8f 100644
--- a/lib/srp/util.rb
+++ b/lib/srp/util.rb
@@ -33,6 +33,14 @@ d15dc7d7b46154d6b6ce8ef4ad69b15d4982559b297bcf1885c529f566660e5
Digest::SHA1.hexdigest(s)
end
+ def sha256_hex(h)
+ Digest::SHA2.hexdigest([h].pack('H*'))
+ end
+
+ def sha256_str(s)
+ Digest::SHA2.hexdigest(s)
+ end
+
def bigrand(bytes)
OpenSSL::Random.random_bytes(bytes).unpack("H*")[0]
end