Module: MysqlMakeScrambledPassword::Core

Defined in:
ext/mysql_make_scrambled_password_core.c

Class Method Summary collapse

Class Method Details

.make_scrambled_password(v_password) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'ext/mysql_make_scrambled_password_core.c', line 3

static VALUE rb_make_scrambled_password(VALUE self, VALUE v_password) {
  char *password;
  char *buf;
  size_t len;

  Check_Type(v_password, T_STRING);

  len = RSTRING_LEN(v_password);

  if (len < 1) {
    return v_password;
  }

  password = RSTRING_PTR(v_password);
  buf = alloca(CRYPT_MAX_PASSWORD_SIZE_PLUS_BUF + 1);

  make_scrambled_password(buf, password);

  return rb_str_new2(buf);
}

.make_scrambled_password_323(v_password) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'ext/mysql_make_scrambled_password_core.c', line 25

static VALUE rb_make_scrambled_password_323(VALUE self, VALUE v_password) {
  char *password;
  char *buf;
  size_t len;

  Check_Type(v_password, T_STRING);

  len = RSTRING_LEN(v_password);

  if (len < 1) {
    return v_password;
  }

  password = RSTRING_PTR(v_password);
  buf = alloca(CRYPT_MAX_PASSWORD_SIZE_PLUS_BUF + 1);

  make_scrambled_password_323(buf, password);

  return rb_str_new2(buf);
}