01-19-2012, 04:07 PM
(This post was last modified: 01-19-2012, 04:32 PM by strandedpirate.)
These are generated using C# with the code below. I attached a screen shot too. I can't get my code to generate a string matching the ones you posted. I think the issue is encoding. I've tried all the available ones in the framework. It seems that hashcat assumes a specific encoding and any other encoding will cause it to fail. Can you post the source code for the way your generating your hashes?
private void btnCreateHash_Click(object sender, EventArgs e)
{
txtHexUTF32.Text = HashPasswordAsHex(txtSource.Text, Encoding.UTF32);
txtHexUTF16.Text = HashPasswordAsHex(txtSource.Text, Encoding.Unicode);
txtHexUTF8.Text = HashPasswordAsHex(txtSource.Text, Encoding.UTF8);
txtHexUTF7.Text = HashPasswordAsHex(txtSource.Text, Encoding.UTF7);
txtHexASCII.Text = HashPasswordAsHex(txtSource.Text, Encoding.ASCII);
txtHexBigEndianUnicode.Text = HashPasswordAsHex(txtSource.Text, Encoding.BigEndianUnicode);
txtUTF32Base64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.UTF32);
txtUTF16Base64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.Unicode);
txtUTF8Base64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.UTF8);
txtUTF7Base64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.UTF7);
txtASCIIBase64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.ASCII);
txtBigEndianUnicodeBase64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.BigEndianUnicode);
}
private string HashPasswordAsHex(string password, Encoding encoding)
{
using (HMACSHA1 hash = new HMACSHA1(encoding.GetBytes(password)))
{
return BytesToHex(hash.ComputeHash(encoding.GetBytes(password)));
}
}
private string HashPasswordAsBase64(string password, Encoding encoding)
{
using (HMACSHA1 hash = new HMACSHA1(Encoding.Unicode.GetBytes(password)))
{
return Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(password)));
}
}
private static string BytesToHex(byte[] toConvert)
{
StringBuilder s = new StringBuilder(toConvert.Length * 2);
foreach (byte b in toConvert)
{
s.Append(b.ToString("x2"));
}
return s.ToString();
}
private void btnCreateHash_Click(object sender, EventArgs e)
{
txtHexUTF32.Text = HashPasswordAsHex(txtSource.Text, Encoding.UTF32);
txtHexUTF16.Text = HashPasswordAsHex(txtSource.Text, Encoding.Unicode);
txtHexUTF8.Text = HashPasswordAsHex(txtSource.Text, Encoding.UTF8);
txtHexUTF7.Text = HashPasswordAsHex(txtSource.Text, Encoding.UTF7);
txtHexASCII.Text = HashPasswordAsHex(txtSource.Text, Encoding.ASCII);
txtHexBigEndianUnicode.Text = HashPasswordAsHex(txtSource.Text, Encoding.BigEndianUnicode);
txtUTF32Base64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.UTF32);
txtUTF16Base64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.Unicode);
txtUTF8Base64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.UTF8);
txtUTF7Base64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.UTF7);
txtASCIIBase64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.ASCII);
txtBigEndianUnicodeBase64.Text = HashPasswordAsBase64(txtSource.Text, Encoding.BigEndianUnicode);
}
private string HashPasswordAsHex(string password, Encoding encoding)
{
using (HMACSHA1 hash = new HMACSHA1(encoding.GetBytes(password)))
{
return BytesToHex(hash.ComputeHash(encoding.GetBytes(password)));
}
}
private string HashPasswordAsBase64(string password, Encoding encoding)
{
using (HMACSHA1 hash = new HMACSHA1(Encoding.Unicode.GetBytes(password)))
{
return Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(password)));
}
}
private static string BytesToHex(byte[] toConvert)
{
StringBuilder s = new StringBuilder(toConvert.Length * 2);
foreach (byte b in toConvert)
{
s.Append(b.ToString("x2"));
}
return s.ToString();
}