问题描述
我似乎找不到差异的来源。我在这个在线解密工具中发现了这个差异。
我有一些加密的Blowfish数据,我试图通过Python解密PyCrypto模块。然而,问题是数据似乎是用blowfish-compat进行加密的,因为这是通过在线工具进行解密所需要的;我无法通过PyCrypto的模块进行解密,我正在收集它使用严格的Blowfish解密(而不是Blowfish-compat,无论是什么)。
是吗可能通过Python解密blowfish-compat?我不知道两者之间的差异。
好的问题。它似乎是特定于mcrypt / libmcrypt程序的东西。
我找不到任何文档,所以我查看了libmcrypt的源代码。其中包含两个模块,一个用于河豚,一个用于吹气相容。当我看着那些,唯一的区别我可以看到(警告:我是软件工程师,但不是一个加密专家)是字节顺序的逻辑被交换( ifdef WORDS_BIGENDIAN
被替换为 ifndef WORDS_BIGENDIAN
- 注意n)。
所以我的猜测是用于解码在小端机上编码的大端机器上的数据,反之亦然。或者也许有一些惯例,代码应该遵循字节顺序,但有些图书馆打破它,这将补偿。
更新 aha!而且知道沸腾兼容大端的搜索引擎看起来像是确认。请参阅看起来可能会起作用(pypi页面 - )。
(这是长时间提供的最有趣的答案之一:o)
哦,我得到了源从按照浏览所有文件链接在下载按钮下(按钮下载mcrypt,而不是libmcrypt)。
I can't seem to find a source for the differences. I've found this difference in this online decryption tool
http://www.tools4noobs.com/online_tools/decrypt/
I have some encrypted Blowfish data that I'm trying to decrypt through Python's PyCrypto module. The problem, however, is that the data seems to be encrypted with "blowfish-compat", as that's what it takes to decrypt it through the online tool; I can't decrypt it through PyCrypto's module, and I'm gathering that it uses strictly Blowfish decryption (and not Blowfish-compat, whatever that is).
Is it possible to decrypt blowfish-compat through Python somehow? I don't know the differences between the two.
good question. it seems to be something specific to the mcrypt/libmcrypt program.
i couldn't find any docs so i looked at the source for libmcrypt. that contains two modules, one for blowfish, and one for blowfish-compat. when i look at those, the only difference i can see (warning: i am a software engineer, but not a crypto specialist) is that the logic for byte order is swapped (ifdef WORDS_BIGENDIAN
is replaced by ifndef WORDS_BIGENDIAN
- note the "n").
so my guess is that it is for decoding data on big-endian machines that was encoded on little-endian machines, or vice-versa. or perhaps there is some convention that code should follow about endianness, but some libraries break it, and this compensates.
update aha! and knowing that, googling for "blowfish-compat big-endian" turns up what looks like confirmation. see http://www.spinics.net/lists/crypto/msg00175.html - which discusses an incorrect implementation that got the ordering reversed.
so, in short, your data were incorrectly encoded. the "compat" mode reproduces the bug so that they can be decoded.
given that, it looks like you're short-of-luck on the python front unless you can find a python interface to mcrypt. http://labix.org/python-mcrypt looks like it might work (pypi page - http://pypi.python.org/pypi/python-mcrypt).
(this was one of the most fun answers to provide in a long time :o)
oh, and i got the source from http://sourceforge.net/projects/mcrypt/ by following the "browse all files" link under the download button (the button downloads mcrypt, not libmcrypt).
这篇关于Blowfish和Blowfish-compat有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!