javascript - Why does this ciphertext always start with the same characters? -
I started off with cryptogues and I have seen something weird: the ciphertex always starts with the same string of letters. Here's the code to encrypt (I know the monastery is not revolutionary cryptically secure, it was very quick and dirty).
  function controller ($ scope) {$ scope.Text = ""; $ Scope.CipherText = ""; $ Scope.Key = Math.random (). toString (); $ Scope.Encrypt = function ($ event) {$ scope.CipherText = CryptoJS.AES.encrypt ($ scope.Text, $ scope.Key) .toString (); }}    With HTML:  
  & lt; Div ng-controller = "controller" & gt; & Lt; Div & gt; Your key is: "{{key}}". & Lt; / Div & gt; & Lt; Div & gt; & Lt; textarea ng-change = "encrypt ()" ng-model = "text" max length = "140" & gt; {{Text}} & lt; / Textarea & gt; & Lt; Br / & gt; 140 & lt; Span & gt; {{Text.length}} & lt; / Span & gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; Textarea ng-model = "ciphertext" maxylanth = "216" & gt; {{Ciphertext}} & lt; / Textarea & gt; & Lt; Br / & gt; 216K & lt; Span & gt; {{CipherText.length}} & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt;    After a few runs, I found that base 64 ciphertex always starts with some characters. The key  .5640227501280606 :    A: U2FsdGVkX19kMKXVbnJHKbEkrwctAm2YbOTnPmtGRCg = b: U2FsdGVkX18 + 0sG2DQzVgHwxH2cvrSqaDIxOOkUt5YU = c: U2FsdGVkX19xGQdT6OUhbyyg1zfgqpGnWvF5Ibqkuqc =    I different Try this with the keys, and the different length plain field The ciphertex always starts with  U2FsdGVkX1 . What's going on here? Does cryptoges store some internal information? Or is it normal for AES in certain circumstances?    
  decoding the string, it seems  
  U2FsdGVkX19    decoded  
  Salted_     
 Therefore it is added by crypto as a salt A string   
 
Comments
Post a Comment