0

I want to send a hashed data to the database.thats my data:

0MPA00JQ'Q:0TGF6T?>TE)pRc1.kA<<\I<b3@ZaR<BXq].k#1A6mm"`>:s_c<+RjO:,Y$i2`Y;E

But because the data has a lot of symbols, I encounter the following error:

mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0MPA00JQ'Q:0TGF6T?>TE)pRc1.kA<<\I<b3@ZaR<BXq].k#1A6mm">:s_c<+RjO:,Y$i2Y;E"", "' at line 1

I tried many methods but none of them worked with the same error! Methods I used:

sql = """INSERT INTO {}(disc, data) VALUES (""{}"", ""{}"")""".format(tb,hash_for_data(disc),hash_for_data(data))

sql = """INSERT INTO %s(disc, data) VALUES (""%s"", ""%s"")""" % (TABLE, HASHED_DATA_1, HASHED_DATA_2)

And a few other methods

eshirvana
  • 23,227
  • 3
  • 22
  • 38

1 Answers1

0

The only way it worked was to finally hash the hash data:

base64.b16encode(HASHED DATA)

In this way the output is equal to the digit without the symbol