1 Reply Latest reply on Dec 17, 2009 2:33 AM by iamfuric

    Problem with computeDigest of SHA256

    lakersfan741

      Hello,

             The following is  my actionscript code to compute digest for old and new password whenever you change password.

       

       

       

       

       

       

       

       

       

       

      var newBytes:ByteArray = new

      ByteArray();

       

       

      var oldBytes:ByteArray = new

      ByteArray();

       

      saveAccount.request.username = userName;

      oldBytes.writeUTFBytes(

       

      "aaaa"

      );

       

       

      var

      len:int = oldBytes.length;

       

       

      var temp:String = oldBytes.toString();

      //SHA256.computeDigest(oldBytes);

      saveAccount.request.oldpassword = SHA256.computeDigest(oldBytes);

      newBytes.writeUTFBytes(

       

      "qqqq"

      );

      len = newBytes.length;

      temp = newBytes.toString();

       

      //SHA256.computeDigest(newBytes);

      saveAccount.request.newpassword = SHA256.computeDigest(newBytes);

      saveAccount.send();

       

      I hard coded the old password and new password to make sure what i get after compute digest.. but surprisingly both compute digest of both oldBytes and newBytes give the same digest.."df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" . Only when the number of characters in the old and new password are different then the digest differs?.. is this right?

       

      Thanks,

      Bharani