Module: PBKDF256
- Extended by:
- PBKDF256
- Included in:
- PBKDF256
- Defined in:
- lib/pbkdf256.rb,
lib/pbkdf256/version.rb,
ext/core/_pbkdf256.c
Constant Summary collapse
- VERSION =
PBKDF256 version
"0.1.3"
Class Method Summary collapse
-
.pbkdf2_sha256(passwd, salt, iter, key_len) ⇒ String
(also: dk, pbkdf2_sha256)
Computed derived key.
Class Method Details
.pbkdf2_sha256(passwd, salt, iter, key_len) ⇒ String Also known as: dk, pbkdf2_sha256
Returns Computed derived key.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'ext/core/_pbkdf256.c', line 16
static VALUE
m_pbkdf2_hmac_sha256(VALUE self, VALUE passwd, VALUE salt, VALUE iter, VALUE key_len)
{
StringValue(passwd);
StringValue(salt);
size_t dk_buff_len = NUM2UINT(key_len);
VALUE s;
s = rb_str_new(0, dk_buff_len);
s_PBKDF2_SHA256((const uint8_t *) RSTRING_PTR(passwd), RSTRING_LEN(passwd),
(const uint8_t *) RSTRING_PTR(salt), RSTRING_LEN(salt), NUM2ULL(iter),
RSTRING_PTR(s), dk_buff_len);
return s;
}
|