Computing an md5 hash of a data structure

json.dumps() can sort dictionaries by key. So you don’t need other dependencies: import hashlib import json data = [‘only’, ‘lists’, [1,2,3], ‘dictionaries’, {‘a’:0,’b’:1}, ‘numbers’, 47, ‘strings’] data_md5 = hashlib.md5(json.dumps(data, sort_keys=True).encode(‘utf-8’)).hexdigest() print(data_md5) Prints: 87e83d90fc0d03f2c05631e2cd68ea02

What is currently the most secure one-way encryption algorithm?

Warning: Since this post was written in 2010, GPUs have been widely deployed to brute-force password hashes. Moderately-priced GPUs can run ten billion MD5s per second. This means that even a completely-random 8-character alphanumeric password (62 possible characters) can be brute forced in 6 hours. SHA-1 is only slightly slower, it’d take one day. Your … Read more

What is the best way to create a random hash/string?

bin2hex(mcrypt_create_iv(22, MCRYPT_DEV_URANDOM)); mcrypt_create_iv will give you a random sequence of bytes. bin2hex will convert it to ASCII text Example output: d2c63a605ae27c13e43e26fe2c97a36c4556846dd3ef Bare in mind that “best” is a relative term. You have a tradeoff to make between security, uniqueness and speed. The above example is good for 99% of the cases, though if you are … Read more

How to generate an MD5 checksum for a file in Android?

This code is from the CMupdater, from the CyanogenMod 10.2 android ROM. It tests the downloaded ROMs into the updater App. code: https://github.com/CyanogenMod/android_packages_apps_CMUpdater/blob/cm-10.2/src/com/cyanogenmod/updater/utils/MD5.java It works like a charm: /* * Copyright (C) 2012 The CyanogenMod Project * * * Licensed under the GNU GPLv2 license * * The text of the license can be found … Read more

encrypt and decrypt md5

As already stated, you cannot decrypt MD5 without attempting something like brute force hacking which is extremely resource intensive, not practical, and unethical. However you could use something like this to encrypt / decrypt passwords/etc safely: $input = “SmackFactory”; $encrypted = encryptIt( $input ); $decrypted = decryptIt( $encrypted ); echo $encrypted . ‘<br />’ . … Read more

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