You are right about the padding, I am unsure as to how BlowfishSimple does it.
It doesn't y. You do it in the Encrypt function you presented.
I have tried a few things and am just not sure how I should proceed.
Comparing the libraries and see where they differ.
| [reply] |
You are right about the padding, I am unsure as to how BlowfishSimple does it.
It doesn't you do it in the Encrypt function you presented.
The encrypt subroutine I pasted above was from from the BlowfishSimple class. It comes as part of the BlowfishNET download. I was comparing the libraries to see how the two encrypt and decrypt and I believe they pad differently. That is the reason I pasted the subroutine here. I thought I had mentioned it.
As far using the BlowfishSimple library/class, it pretty much boils down to making the following calls:
bfs = new BlowfishSimple(key);
enc = bfs.Encrypt(plaintext);
So, as you can see that is why I keep querying about how the padding is done in BlowfishSimple, because that is what I thought is different, but then, I am not sure.
Thank you for your help. | [reply] [d/l] |
BlowfishSimple:
$fill = $unpadded_len % $block_size;
Crypt::CBC (by default):
$fill = $pad_size;
| size of padding |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| padded with | BlowfishSimple | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | (For cyphers with a blocksize of 8) |
| Crypt::CBC | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Update: I accidentally had the note about blocksize dependence attached to Crypt::CBC. Fixed.
| [reply] |