I'm unsure how qt gets distributed on other platforms, but on windows, at least
with J, the same dll as openssl's hash/encryption function is placed in the bin
folder, and the strategy of hoping openssl exists on other target systems seems
reasonable.
there is a difference in the hash obtained from the direct openssl function and
the libjqt function when you apply it to a multiitem shape. It is the same
when you do sha of rank1 sha... so one of us probably has fills messing things
up.
aa =.'asf',"1 (65+ 26 26 26 #:"1 0 i. 26^3) { a.
sha1 hexhash sha1"1 hexhash aa
2ab12374f4827925d7c3260aa22fe96e3b08fcbe
getsha1 getsha1"1 aa
2ab12374f4827925d7c3260aa22fe96e3b08fcbe
sha1 hexhash aa
b600048b4943c0264408c56c7c8b392207da1cff
getsha1 aa
8b3b7e7cdee149043fcfd5cc5adf67b355d2bd32
The openssl version returns raw binary rather than hex. So its faster if the
raw binary is useful, or if you would want a transformation (decimal, list of
32/64 bit integers, base64/128) other than hex.
ts 'sha1"1 aa'
9.13521/sec 0.530048MB
ts 'sha1 hexhash"1 aa'
2.20878/sec 1.06778MB
ts 'getsha1"1 aa'
2.69064/sec 1.05856MB
________________________________
From: chris burke <[email protected]>
To: Programming forum <[email protected]>
Sent: Tuesday, July 15, 2014 3:34:15 PM
Subject: Re: [Jprogramming] md5
The code is from Qt.
>From the docs, http://qt-project.org/doc/qt-5/QCryptographicHash.html, Qt
5.2 supports MD4, MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512, so
your first two can easily be added, except on Linux where we are still
using Qt 4.8.
On Tue, Jul 15, 2014 at 9:19 AM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:
> May I suggest also sha256 sha512 and ripemd160?
>
> I assume the underlying code is from openssl. The reason I did not
> include md5 there is that it has been baptised insecure/compromised by the
> wiki lords http://en.wikipedia.org/wiki/Cryptographic_hash_function. The
> paper describing the collision attack on md5:
> http://eprint.iacr.org/2009/223.pdf. Its not a craft any replacement
> attack/weakness by any means, but its enough to discourage its use in the
> same sense that "no one ever got fired for buying IBM".
>
>
>
> ________________________________
> From: chris burke <[email protected]>
> To: Programming forum <[email protected]>
> Sent: Tuesday, July 15, 2014 11:11:01 AM
> Subject: Re: [Jprogramming] md5
>
>
> getmd5 will be in the next release of JQt (getsha1 is already there).
>
> AFAIK, convert/misc/md5 only works on 32-bit.
>
>
> On Mon, Jul 14, 2014 at 7:10 PM, Raul Miller <[email protected]>
> wrote:
>
> > I've been using the convert/misc/md5 addon, but it is rather slow.
> >
> > Using it on a 140k string on a moderately sized box was taking between 6
> > and 7 seconds. And I've got a lot of strings for it to grind through
> (many
> > gigabytes).
> >
> > So I decided I wanted to use compiled code. And, since we don't have a J
> > compiler (yet), I decided to use C:
> >
> > The first thing I did was look at the source for the md5 on an ubuntu
> > system. That's in coreutils, and it was something of a mess.
> >
> > After backing off from trying to extract the useful parts of that as a
> > shared library, I found that RFC 1321 contains a reference implementation
> > (which looks like it was the basis for the mess I was trying to work
> > with*). That was clean enough that I could rather easily extract it,
> build
> > it, and get it to work.
> >
> > The result is at https://github.com/rdm/libmd5.so
> >
> > The J test suite (
> https://github.com/rdm/libmd5.so/blob/master/md5test.ijs
> > )
> > was also extracted from RFC 1321, except for a couple lines which define
> > the interface to the compiled code).
> >
> > Note that I'm using this with j602 (the 32 bit version), because that's
> the
> > only version where the sax xml parsing works. And, I've only tested it on
> > ubuntu 14.04 lts. But if someone else needs a fast md5 implementation,
> > perhaps it won't be too much work to get this working on whatever system
> > you work with.
> >
> > FYI,
> >
> > --
> > Raul
> >
> > * P.S. I say "mess" because it has been loaded down with so many layers
> of
> > config toolchain and abstraction that it's really hard to find where
> > anything happens. That's fine for some contexts, but useless for others.
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm