如何在查询中将哈希md5大写?

时间:2017-07-15 13:56:33

标签: sql node.js passport.js md5

如何在哈希md5进入数据库之前将其大写?

我尝试了以下内容:

def func_resolve(self,dll,function):

    _GetModuleHandleA = kernel32.GetModuleHandleA
    _GetModuleHandleA.restype = POINTER(c_void_p)

    _GetProcAddress = kernel32.GetProcAddress
    _GetProcAddress.restype = c_void_p

    handle = _GetModuleHandleA(dll)
    if handle is None:
        print 'Error getting handle'

    address = _GetProcAddress(handle, function)
    if address is None:
        print 'Error getting address'

    kernel32.CloseHandle(handle)
    return address

这样可行,但它不会使刚注册的用户大写。它在数据库中每隔一个md5哈希大写。

这是我的INSERT查询:

connection.query("UPDATE penguins SET password = UPPER(password)");

这是我的整个护照策略:

var insertQuery = "INSERT INTO penguins (moderator, registrationdate, inventory, email, password, username, nickname ) VALUES ('" + moderator + "','" + registrationdate + "','" + inventory + "','" + email +  "', + MD5('" + password + "'), '" + username + "', '"+username+"')";

1 个答案:

答案 0 :(得分:0)

你是否在插入语句中尝试过UPPER(),希望这可行。

    var insertQuery = "INSERT INTO penguins (moderator, registrationdate, inventory, email, password, username, nickname ) VALUES ('" + moderator + "',UNIX_TIMESTAMP(),'" + inventory + "','" + email +  "', + UPPER(MD5('" + password + "')), '" + username + "', '"+username+"')";