Class: RubyOlm::Utility

Inherits:
Object
  • Object
show all
Defined in:
ext/ruby_olm/ext_lib_olm/ext_utility.c

Instance Method Summary collapse

Instance Method Details

#ed25519_verify(data) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'ext/ruby_olm/ext_lib_olm/ext_utility.c', line 26

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);
}

#sha256(data) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'ext/ruby_olm/ext_lib_olm/ext_utility.c', line 26

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);
}