Online Hash Calculator

Supported hash types: md5, sha1, sha224, sha256, sha384, sha512, dsaEncryption, ripemd160, md4, DSA, whirlpool, crc32, nthash, lmhash.




A hash function is any function that can be used to map digital data of arbitrary size to digital data of fixed size. A cryptographic hash function allows one to easily verify that some input data maps to a given hash value, but if the input data is unknown, it is deliberately difficult to reconstruct it (or equivalent alternatives) by knowing the stored hash value.

MD5 in Python

import hashlib
h = hashlib.new('md5')
h.update('text')
print h.hexdigest()

MD5 in PHP

echo md5('text')

MD5 in C/C++

#include<openssl/evp.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
unsigned char *getMd5Hash(unsigned char *data, size_t dataLen, int *mdLen) {
    unsigned char *md = NULL;
    EVP_MD_CTX *ctx = NULL;
    const EVP_MD *mdType = EVP_md5();
    
    *mdLen = EVP_MD_size(mdType);
    
    md = (unsigned char *) malloc(*mdLen);
    ctx = EVP_MD_CTX_create();
    
    EVP_MD_CTX_init(ctx);
    EVP_DigestInit_ex(ctx, mdType, NULL);
    EVP_DigestUpdate(ctx, data, dataLen);
    EVP_DigestFinal_ex(ctx, md, NULL);
    EVP_MD_CTX_cleanup(ctx);
    EVP_MD_CTX_destroy(ctx);
    return md;
}
int main() {
    char data[1024];
    unsigned char *md;
    int i = 0, mdLen = 0;
    
    memset(&data, 0, 1024);
    
    scanf("%s", data);
    md = getMd5Hash((unsigned char *)data, strlen(data), &mdLen);
    
    for(i = 0; i < mdLen; i++) {
        printf("%02x",md[i]);
    } printf("\n");
    return 0;
}

MD5 in Ruby

require 'digest'
md5 = Digest::MD5.new
md5.update 'text'
md5.hexdigest