On 8/22/19 1:18 PM, Razvan Cojocaru wrote:
> Hello,
> 
> Is it possible to trick crypto++ into using blowfish-compat?
> 
> https://stackoverflow.com/questions/11422497/whats-the-difference-between-blowfish-and-blowfish-compat
> 
> I saw ByteOrder being used in several headers, but it doesn't appear to
> apply to this case. The blowfish algorithm itself appears to ignore it
> and the comments say it's only relevant for other encryption types.

As it turns out, only this change appears to be needed:

diff --git a/blowfish.cpp b/blowfish.cpp
index e615da3b..12213c0e 100644
--- a/blowfish.cpp
+++ b/blowfish.cpp
@@ -70,7 +70,7 @@ void Blowfish::Base::crypt_block(const word32 in[2],
word32 out[2]) const

 void Blowfish::Base::ProcessAndXorBlock(const byte *inBlock, const byte
*xorBlock, byte *outBlock) const
 {
-       typedef BlockGetAndPut<word32, BigEndian> Block;
+       typedef BlockGetAndPut<word32, LittleEndian> Block;

        word32 left, right;
        Block::Get(inBlock)(left)(right);

But I'd like to do a proper pull request and have this upstream. I'm
guessing the way to go is to add a new BlowfishCompat class, like XTEA
is for TEA? In which case we need to think about the statics in
bfinit.cpp, we probably don't want to copy-paste them.

Or can we somehow add a parameter to the current Blowfish class
somewhere to switch on the compat behaviour when needed?


Thanks,
Razvan

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/ad98d7a0-4b03-090c-bb1e-0f90d1909305%40gmail.com.

Reply via email to