//C# MD5 function
using System;
using System.Text;
using System.Security.Cryptography;
string createMD5Hash(string input){
//Create a MD5 object
MD5 md5obj = MD5.Create();
//The ComputeHash method takes an array of bytes as a parameter
byte[] md5hash = md5obj.ComputeHash(Encoding.ASCII.GetBytes(input));
//The array of bytes will be converted to a string
return BitConverter.ToString(md5hash);
}
#Python MD5 function
import hashlib
def createMD5Hash(input):
#Create a MD5 object
md5obj = hashlib.md5(input)
#Return the MD5 value by calling the hexdigest method
return md5obj.hexdigest()
def createSHA(input,bit):
if bit == 256:
from hashlib import sha256;
temp=sha256(input);
elif bit == 512:
from hashlib import sha512;
temp=sha512(input);
elif bit == 1:
from hashlib import sha1;
temp=sha1(input);
else:
return "1, 256 or 512 accepted bit types only";
return temp.hexdigest();
createSHA("Pirates",512);
createSHA("Pirates",256);
createSHA("Pirates",1);
def createSHA(input,bit):
if bit == 256:
from hashlib import sha256;
temp=sha256(input);
elif bit == 512:
from hashlib import sha512;
temp=sha512(input);
elif bit == 1:
from hashlib import sha1;
temp=sha1(input);
else:
return "1, 256 or 512 accepted bit types only";
return temp.hexdigest();
createSHA("Pirates",512);
createSHA("Pirates",256);
createSHA("Pirates",1);
Copyright © 2024, NextGenUpdate.
All Rights Reserved.