47
String *MySQLPassword::val_str(String *str)
47
drizzled::String *MySQLPassword::val_str(drizzled::String *str)
50
String *password= args[0]->val_str(&argument);
49
drizzled::String argument;
50
drizzled::String *password= args[0]->val_str(&argument);
51
drizzled::SHA1_CTX ctx;
52
52
uint8_t hash_tmp1[SHA1_DIGEST_LENGTH];
53
53
uint8_t hash_tmp2[SHA1_DIGEST_LENGTH];
56
SHA1Update(&ctx, reinterpret_cast<uint8_t *>(password->ptr()),
58
SHA1Final(hash_tmp1, &ctx);
55
drizzled::SHA1Init(&ctx);
56
drizzled::SHA1Update(&ctx, reinterpret_cast<uint8_t *>(password->ptr()),
58
drizzled::SHA1Final(hash_tmp1, &ctx);
61
SHA1Update(&ctx, hash_tmp1, SHA1_DIGEST_LENGTH);
62
SHA1Final(hash_tmp2, &ctx);
60
drizzled::SHA1Init(&ctx);
61
drizzled::SHA1Update(&ctx, hash_tmp1, SHA1_DIGEST_LENGTH);
62
drizzled::SHA1Final(hash_tmp2, &ctx);
64
64
str->realloc(SHA1_DIGEST_LENGTH * 2);
65
drizzled_string_to_hex(str->ptr(), reinterpret_cast<const char*>(hash_tmp2),
65
drizzled::drizzled_string_to_hex(str->ptr(),
66
reinterpret_cast<const char*>(hash_tmp2),
67
68
str->length(SHA1_DIGEST_LENGTH * 2);
73
} /* namespace drizzle_plugin */