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


Groups > comp.lang.forth > #18838 > unrolled thread

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

Started byjzakiya@gmail.com
First post2013-01-15 21:31 -0800
Last post2013-01-16 23:29 +0100
Articles 6 on this page of 26 — 5 participants

Back to article view | Back to comp.lang.forth


Contents

  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

Page 2 of 2 — ← Prev page 1 [2]


#18966

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2013-01-21 17:22 +0000
Message-ID<2013Jan21.182224@mips.complang.tuwien.ac.at>
In reply to#18917
mhx@iae.nl (Marcel Hendrix) writes:
>It might even follow that there is no advantage in using registers
>over directly adressed memory locations...

That would be wrong.  The main difference between gforth-fast and
gforth is that the former keeps more stuff in registers, in particular
the instruction and the return-stack pointer.  And there is a
significant performance difference between gforth-fast and gforth:

./gforth-fast --dynamic onebench.fs
sieve bubble matrix  fib
 0.112 0.228  0.080 0.188
./gforth --dynamic onebench.fs
sieve bubble matrix  fib
 0.336 0.428  0.244 0.504

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2012: http://www.euroforth.org/ef12/

[toc] | [prev] | [next] | [standalone]


#18974

Frommhx@iae.nl (Marcel Hendrix)
Date2013-01-21 22:51 +0200
Message-ID<68841314028434@frunobulax.edu>
In reply to#18966
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth

> mhx@iae.nl (Marcel Hendrix) writes:
>>It might even follow that there is no advantage in using registers
>>over directly adressed memory locations...

> That would be wrong.  The main difference between gforth-fast and
> gforth is that the former keeps more stuff in registers, in particular
> the instruction and the return-stack pointer.  And there is a
> significant performance difference between gforth-fast and gforth:

> ./gforth-fast --dynamic onebench.fs
> sieve bubble matrix  fib
> 0.112 0.228  0.080 0.188
> ./gforth --dynamic onebench.fs
> sieve bubble matrix  fib
> 0.336 0.428  0.244 0.504

You mean that the speed of gforth-fast is because it uses a register
instead of fixed memory location for frequently used stuff?

I thought the speed resulted from a more direct path to the needed 
data, e.g. no  ape @ @ @ @ @ to get the data, because it is already 
in rax? (less instructions).

Again, I might quantify the  mem/reg  question by translating a
small CODE word by hand.

-marcel

[toc] | [prev] | [next] | [standalone]


#19007

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2013-01-22 17:26 +0000
Message-ID<2013Jan22.182657@mips.complang.tuwien.ac.at>
In reply to#18974
mhx@iae.nl (Marcel Hendrix) writes:
>You mean that the speed of gforth-fast is because it uses a register
>instead of fixed memory location for frequently used stuff?

Yes.

>I thought the speed resulted from a more direct path to the needed 
>data, e.g. no  ape @ @ @ @ @ to get the data, because it is already 
>in rax? (less instructions).

You lost me here.  But sure, keeping stuff in memory instead of
registers often costs more instructions.

To make this more concrete, here's the code for +

gforth-fast              gforth
IP=%rbx SP=%r15 TOS=%r14 IP=%rbx SP=%r15
                         mov    %rbx,0x23e4af(%rip) 
mov    %r15,%rax         mov    %r15,%rax
                         mov    (%r15),%rdx
lea    0x8(%rbx),%rbx--+ 
lea    0x8(%r15),%r15  | lea    0x8(%r15),%r15
add    0x8(%rax),%r14  | add    %rdx,0x8(%rax)
                       +-add    $0x8,%rbx
mov    -0x8(%rbx),%rbp   mov    -0x8(%rbx),%rbp
mov    %rbp,%rax         mov    %rbp,%rax
NEXT                     NEXT

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2012: http://www.euroforth.org/ef12/

[toc] | [prev] | [next] | [standalone]


#18883

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2013-01-18 16:50 +0000
Message-ID<2013Jan18.175009@mips.complang.tuwien.ac.at>
In reply to#18856
Bernd Paysan <bernd.paysan@gmx.de> writes:
>jzakiya@gmail.com wrote:
>> I have gforth 0.7 and couldn't find anything more recent or for 64-bit
>> systems.
>
>Where have you looked?  0.7 is the last stable release; it works fine on 
>64 bit systems.

Gforth has worked on 64-bit systems since 1995-11-09, i.e., the first
realease (0.1beta in December 1995) already supported 64-bit systems.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2012: http://www.euroforth.org/ef12/

[toc] | [prev] | [next] | [standalone]


#18858

Frommhx@iae.nl (Marcel Hendrix)
Date2013-01-16 19:53 +0200
Message-ID<05821619028434@frunobulax.edu>
In reply to#18845
Bernd writes Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS Forth

Sorry,

: padded>sponge ( addr u1 u2 -- )  >r
    \ pad last round
    kpad r@ erase  tuck kpad swap move
    kpad + 1 swap c!
    kpad r@ + 1- dup c@ $80 or swap c!
    kpad r> >sponge  ;

How do I test it? What's that top parameter u2 doing?

-marcel

[toc] | [prev] | [next] | [standalone]


#18859

FromBernd Paysan <bernd.paysan@gmx.de>
Date2013-01-16 23:29 +0100
Message-ID<3125050.hBGIyu7XvG@sunwukong.fritz.box>
In reply to#18858
Marcel Hendrix wrote:

> Bernd writes Re: ANN: All FIPS 180-4 Secure Hash Algorithms in ANS
> Forth
> 
> Sorry,
> 
> : padded>sponge ( addr u1 u2 -- )  >r
>     \ pad last round
>     kpad r@ erase  tuck kpad swap move
>     kpad + 1 swap c!
>     kpad r@ + 1- dup c@ $80 or swap c!
>     kpad r> >sponge  ;
> 
> How do I test it? What's that top parameter u2 doing?

That's the number of bytes you want it to be padded to.  This is only 
the core Keccak stuff, e.g. you want to stuff in 512 bits per round into 
the sponge function (or 576), so you initialize the state to 0, and 
insert 64 or 72 bytes a time of your message into the sponge function.  
The last part needs padding, and you have to tell it to pad up to how 
long.  Maximum is 144 bytes.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.forth


csiph-web