# CryptoJS.AES result always has same first few bytes?

When using this very minimal CryptoJS AES example:

<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
<script type='text/javascript'>
var passphrase = "Secret";
var enc = CryptoJS.AES.encrypt("Message", passphrase);
var result = enc.toString();
var decrypted = CryptoJS.AES.decrypt(result,passphrase).toString(CryptoJS.enc.Utf8);
document.write("Key="+enc.key+"<br>IV="+enc.iv+"<br>Salt="+enc.salt+"<br>Ciphertext="+enc.ciphertext+"<br>Result="+result+"<br>Decrypted="+decrypted);
</script>


(Live demo here: http://jsfiddle.net/RwnYL/)

Note that the Key, IV and Salt are always different. But the output (here displayed as Base64) always starts with the same 10 characters. I'm probably missing something, but why is this?

-

If you decode the resulting cipher text with a base64 decoder it says:

Salted__XXXXXXXXXXX

Where XXXX changes, but "Salted__" doesn't. So I guess it is a prefix added to the ciphertext to define its format.

-
Thanks! Stupid, I never bothered to actually base64-decode it. Well that explains it :) –  RocketNuts Mar 20 '14 at 9:50
Wouldn't that be a pretty easy distinguisher to tell if they're using this library and algorithm (AES) if it's always appending that text to the front of the ciphertext? –  NDF1 Mar 20 '14 at 20:00
Yes it would be. So what? It shouldn't matter. The algorithms and libraries used are always supposed to be known. Under the standard security models everything but the key is supposed to be public. Otherwise you are using security through obscurity. –  izaera Mar 20 '14 at 20:09