[erlang-questions] blowfish ECB implementation in erlang?

Paul Oliver puzza007@REDACTED
Wed Oct 14 10:05:46 CEST 2009


On Sun, Sep 27, 2009 at 11:35 PM, Paul Oliver <puzza007@REDACTED> wrote:

>
>
> On Fri, Sep 25, 2009 at 1:19 PM, Paul Oliver <puzza007@REDACTED> wrote:
>
>> On Wed, Sep 23, 2009 at 8:33 PM, Larry Ogrodnek <larry@REDACTED> wrote:
>>
>>> Hi, I'm wondering if anyone has put together an implementation of
>>> blowfish ECB?
>>>
>>> thanks.
>>>
>>
>> Hi Larry,
>>
>> Check the following page for the patch that added cfb64.
>>
>>
>> http://www.nabble.com/Patch-to-add-Blowfish-cfb64-to-crypto-app-td24232164.html
>>
>> You should almost be able to copy this verbatim to add ecb.
>>
>> Cheers,
>> Paul.
>>
>
> Hi Larry,
>
> The attached patch should do ECB for you.  It works for me on the test data
> I obtained from http://www.schneier.com/code/vectors.txt.
>
> puzza@REDACTED:~/Downloads/otp_src_R13B02-1$ /tmp/bin/erl
> Erlang R13B02 (erts-5.7.3) [source] [smp:2:2] [rq:2] [async-threads:0]
> [kernel-poll:false]
>
> Eshell V5.7.3  (abort with ^G)
> 1> %% FEDCBA9876543210 == Key = <<254,220,186,152,118,84,50,16>>
> 1> %% 0123456789ABCDEF == Clear = <<1,35,69,103,137,171,205,239>>
> 1> %% 0ACEAB0FC6A0A28D == Enc = <<10,206,171,15,198,160,162,141>>
> 1>
> 1> crypto:start().
> ok
> 2> Key = <<254,220,186,152,118,84,50,16>>.
> <<254,220,186,152,118,84,50,16>>
> 3> Clear = <<1,35,69,103,137,171,205,239>>.
> <<1,35,69,103,137,171,205,239>>
> 4> Enc = <<10,206,171,15,198,160,162,141>>.
> <<10,206,171,15,198,160,162,141>>
> 5> Enc == crypto:blowfish_ecb_encrypt(Key, Clear).
> true
> 6>  Clear == crypto:blowfish_ecb_decrypt(Key, Enc).
> true
> 7>
>
> I'm off on holiday tomorrow so if it doesn't work as it should I'll take
> another look in a couple of weeks.  ;}  If it works OK please reply and
> perhaps it can be picked up in a future OTP release.
>
> Cheers,
> Paul.
>

Hi,

I've rounded out the patch to include the rest of the blowfish functions
from openssl and included a primitive test program.

Cheers,
Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20091014/3cc39dc4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blowfish_ecb_cbc_ofb.patch
Type: text/x-diff
Size: 9353 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20091014/3cc39dc4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bf_test.erl
Type: text/x-erlang
Size: 4920 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20091014/3cc39dc4/attachment-0001.bin>


More information about the erlang-patches mailing list