Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/rb-pure25519.rb
Instance Method Summary collapse
- #rb25519_clamp ⇒ Object
-
#to_binary ⇒ Object
Convert to a binary fixed size; LSB first.
Instance Method Details
#rb25519_clamp ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/rb-pure25519.rb', line 53 def rb25519_clamp bytes = self.each_byte.to_a bytes[0] &= 248; bytes[31] &= 127; bytes[31] |= 64; return bytes.pack('c*') end |
#to_binary ⇒ Object
Convert to a binary fixed size; LSB first
46 47 48 49 50 51 52 |
# File 'lib/rb-pure25519.rb', line 46 def to_binary v = 0 self.reverse.each_byte do |byte| v = (v << 8) | byte end v end |