Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #18890

Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth

From mhx@iae.nl (Marcel Hendrix)
Subject Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth
Newsgroups comp.lang.forth
Message-ID <71899416028434@frunobulax.edu> (permalink)
Date 2013-01-19 09:14 +0200
References <3f70f49b-8bf3-456a-aa26-1fcda9666136@googlegroups.com>
Organization Wanadoo

Show all headers | View raw


jzakiya@gmail.com writes Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth

> On Thursday, January 17, 2013 3:36:30 PM UTC-5, Marcel Hendrix wrote:
>> jzakiya@gmail.com writes Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth
[..]
> Thanks for posting the test results.
> The answers are correct.

I am suggesting that you add the expected results of the build-in tests 
to the file. The (conditionally compiled) test words can then auto-check 
if there was any problem. It is not always possible or useful to do that, 
but here it certainly is.

> By the way, I did a version that didn't place the message block words on that 
> stack, but did it in memory, and it's appreciably slower than using the stack.
> PICKing off the stack is much faster than @|! into memory arrays.

OK. I think you remember that I showed a version for SHA-512 which does 
not use PICK and runs the benchmark for EX3 in 10.7 seconds. Your latest
published source (with PICK) compiles on iForth64 and the EX3 bench 
takes about 20 seconds. 

> But now that you have a reference working versions, you can always play around
> with them to see if you can do it faster in a more IForth specific manner.

I can get the EX3 bench down to 17 seconds by *removing* all MACRO 
and ]L and [ ] constructs... Isn't that nice, not even is CODE .. 
ENDCODE obsolete, but also compiler hints are rapidly becoming 
unnecessary. 

It would be interesting to do a straightforward translation of the 
C-description to see if the 'Forth thinking-style' is at all necessary 
to get those results. 
I suspect that it suffices to remove pointer-chasing nighmares and 
locals for the ~20 seconds result. 

> FYI, when I originally did SHA-1 and SHA-256 back in 2000-3 I did ICODEd versions 
> for SwiftForth and VFX that are nearly twice as fast as their ANS Forth versions, 
> but these were specifically tuned to Intel P4 chips back then. 

It would be interesting to know what was P4-specific in the ICODE ? 
I find that my assembly language tricks from the pre-P4 days still 
work. At some point it became important to not mix code and data, 
that's about it.

I have never understood why push and pop are slower than memory 
references on Intel chips. It must be something with changing the 
stack pointer, because other languages use the stack all of the 
time for their locals. However, if it were that, it would suffice 
to use e.g. rbp for the Forth stack. I have never seen reports 
that that is fundamentally faster then using rsp.

>                                                                A decade later 
> these algorithms still must be done serially and can't take 
> advantage of parallel operations in multi-core/threaded cpus.

I don't think time has anything to do with it. This algorithm is 
*designed* to be serial and slow -- you don't want brute force 
cracks to succeed.

I think we will see microcontrollers with on-board FPGA, RSN. 
Maybe the FPGA peripheral will find a way to the desktop. Forth 
has the flexibility and extensibility to use these things :-)

-marcel

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-15 21:31 -0800
  Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-15 21:57 -0800
    Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-26 10:01 -0800
  Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-16 15:25 +0100
    Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-16 09:45 -0800
      Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-16 19:08 +0100
        Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-16 10:32 -0800
          Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-16 23:33 +0100
            Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth Alex McDonald <blog@rivadpm.com> - 2013-01-16 14:53 -0800
              Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-16 20:40 -0800
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2013-01-17 22:36 +0200
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-17 22:24 -0800
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-17 22:46 -0800
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2013-01-19 09:14 +0200
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth Alex McDonald <blog@rivadpm.com> - 2013-01-19 08:24 -0800
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth jzakiya@gmail.com - 2013-01-19 18:10 -0800
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2013-01-20 08:56 +0200
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-20 14:38 +0100
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2013-01-20 16:25 +0200
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth Alex McDonald <blog@rivadpm.com> - 2013-01-20 11:44 -0800
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-21 17:22 +0000
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2013-01-21 22:51 +0200
                Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-22 17:26 +0000
        Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-18 16:50 +0000
    Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2013-01-16 19:53 +0200
      Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-16 23:29 +0100

csiph-web