How to use sha256 in php5.3.0

Could this be a typo? (two Ps in ppasscode, intended?) $_POST[‘ppasscode’]; I would make sure and do: print_r($_POST); and make sure the data is accurate there, and then echo out what it should look like: echo hash(‘sha256’, $_POST[‘ppasscode’]); Compare this output to what you have in the database (manually). By doing this you’re exploring your … Read more

Reversible hash function?

None of the answers provided seemed particularly useful, given the question. I had the same problem, needing a simple, reversible hash for not-security purposes, and decided to go with bit relocation. It’s simple, it’s fast, and it doesn’t require knowing anything about boolean maths or crypo algorithms or anything else that requires actual thinking. The … Read more

Ruby 1.9 hash with a dash in a key

There are some legitimate symbols that cannot be used with the new syntax. I cannot find a reference, but it appears that a symbol name matching /^[a-zA-Z_][a-zA-Z_0-9]*[!?]?$/ is allowed with the new syntax. The last character may be the special character “!” or “?”. For any symbol that does not meet these restrictions, you have … Read more

String similarity score/hash

I believe what you’re looking for is called a Locality Sensitive Hash. Whereas most hash algorithms are designed such that small variations in input cause large changes in output, these hashes attempt the opposite: small changes in input generate proportionally small changes in output. As others have mentioned, there are inherent issues with forcing a … Read more

Why hashmap lookup is O(1) i.e. constant time?

Under the appropriate assumptions on the hash function being used, we can say that hash table lookups take expected O(1) time (assuming you’re using a standard hashing scheme like linear probing or chained hashing). This means that on average, the amount of work that a hash table does to perform a lookup is at most … Read more

HMAC-SHA1: How to do it properly in Java?

On your PHP side, use single-quotes around the key so that the $ character is not treated as a variable reference. i.e., hash_hmac(“sha1”, “helloworld”, ‘PRIE7$oG2uS-Yf17kEnUEpi5hvW/#AFo’) Otherwise, the key you really get is PRIE7-Yf17kEnUEpi5hvW/#AFo (assuming the variable $oG2uS is not defined).

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)