Class: SelfCrypto::Utility
- Inherits:
-
Object
- Object
- SelfCrypto::Utility
- Defined in:
- ext/self_crypto/utility.c
Instance Method Summary collapse
Instance Method Details
#ed25519_verify(data, key, signature) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'ext/self_crypto/utility.c', line 13 static VALUE ed25519_verify(VALUE self, VALUE data, VALUE key, VALUE signature) { VALUE retval = Qtrue; OlmUtility *this; Data_Get_Struct(self, OlmUtility, this); if(olm_ed25519_verify(this, RSTRING_PTR(key), RSTRING_LEN(key), RSTRING_PTR(data), RSTRING_LEN(data), RSTRING_PTR(dup_string(signature)), RSTRING_LEN(signature)) == olm_error()){ retval = Qfalse; } return retval; } |
#sha256(data) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'ext/self_crypto/utility.c', line 98 static VALUE sha256(VALUE self, VALUE data) { size_t size; OlmUtility *this; Data_Get_Struct(self, OlmUtility, this); size = olm_sha256_length(this); uint8_t buf[size]; (void)olm_sha256(this, RSTRING_PTR(data), RSTRING_LEN(data), buf, size); return rb_str_new(buf, size); } |