[erlang-questions] blowfish ECB implementation in erlang?

Paul Oliver puzza007@REDACTED
Mon Sep 28 00:35:33 CEST 2009


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090927/d5ae6644/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Blowfish-ECB.patch
Type: application/octet-stream
Size: 4318 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090927/d5ae6644/attachment.obj>


More information about the erlang-questions mailing list