Skip to content

Padding #1

@bored-engineer

Description

@bored-engineer

A weird issue has come up recently where the padding seems to be messed up.

To replicate:
var me = new Blowfish("me");
var Data = me.encrypt("stuff");
alert(me.decrypt(Data));

It should alert "stuff" but instead its "stuff000"

I wrote this simple addon for the decrypt function to fix it:

//Patch by me to remove trailing zeros
returndata = this.unescape(dec);
revertext = returndata.split("").reverse();
for(i=0;i<8;i++){
  if(revertext[i] == "0"){
    delete revertext[i];
  }
}
returndata = revertext.reverse().join("");*
return returndata;

but it is obviously not ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions