If you are collecting the final SQL from strings, then the hexadecimal string prefix SHA1 0x . Here I assume that you are calculating or getting the given string SHA1, say in the variable strSha1
strSQL = "INSERT INTO TableName SET BinaryHash=0x"; strSQL .= strSha1; DbConn.Query(strSQL);
Or, if you are using parameterized or prepared SQL queries, see the pseudo-code below.
preparedStmt = DbConn.Prepare("INSERT INTO TableName SET BinaryHash = UNHEX( ? )"); DbConn.Query(preparedStmt, strSha1);
Obviously, you can use the SHA1() function from MySQL in the latter case, if you have a plain string provided to you, not SHA1.
source share