-1

Initial conditions:

Private TheKey() As Byte = {1, 2, 3, 4, 5, 6, 7, 8}
Private Vector() As Byte = {&H7C, &H22, &H2F, &HB2, &H92, &H7D, &H82, &H8A}

I then proceed to encrypt the string: "asd" (without quotations) using:

CryptoStream(ms, des.CreateEncryptor(TheKey, Vector), CryptoStreamMode.Write)

input: asd
output: 82804AD2B295E9E3

When i try to encrypt the same string with the same key/vector on http://tripledes.online-domain-tools.com/ as shown below (can't post image due to reputation):

online 3DES encryption

I get a different result.

My ultimate goal is to have this output decrypted in a C application. But two 3DES encryptors giving 2 different results is a show stopper.. Any thoughts about what could be causing this ?

Thanks in advance!

M Aoun
  • 11
  • 5
  • 1
    Your key above is 8 bytes long. I'm not familiar with that web site, but it would appear that the key you input there was a long(ish?) integer. Try using a hex key of 0102030405060708 on that web site. – MarkL Oct 26 '16 at 10:07
  • 3DES should not be used in new work, it is not secure enough, use AES. – zaph Oct 26 '16 at 13:27

1 Answers1

0

A good idea to test your crypto against some other "oracle". But two issues apparent with your use of the online tool:

  • the key should be given as hex not text (the VB code has a byte array). Presumably 0102030405060708
  • 3DES is the algorithm, but the VB code uses classic DES - there's a separate TripleDESCryptoServiceProvider for 3DES

However that site gives me the same encrypted text for both DES and 3DES, so it may not be a reliable oracle anyway? Try another, but may need to use a plain text key (first two I looked at didn't offer hex input in any obvious way)

Tom Goodfellow
  • 882
  • 8
  • 18
  • The key can be specified as text, but turns out i was using classic DES. Had so much issues with thr initial vector but got it to work eventually. Cheers and thanks! – M Aoun Nov 07 '16 at 17:12