Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #18044
| From | mhx@iae.nl (Marcel Hendrix) |
|---|---|
| Subject | Re: SHA-512 |
| Newsgroups | comp.lang.forth |
| Message-ID | <91849318918435@frunobulax.edu> (permalink) |
| Date | 2012-12-17 10:51 +0200 |
| References | <cd9d5192-14e2-46d9-8117-84df2b72d9cd@googlegroups.com> |
| Organization | Wanadoo |
jzakiya@gmail.com writes Re: SHA-512
> On Sunday, December 16, 2012 9:00:07 AM UTC-5, Marcel Hendrix wrote:
> mhx@iae.nl (Marcel Hendrix) writes Re: SHA-512
>>
>> > jzakiya@gmail.com writes Re: SHA-512
>> [..]
>> > I have looked at my own (PICK-less) idea of SHA-512 again, and it couldn't work.
>> > However, I found a way to improve your algorithm (literalize H[x]). ATM test3
>> > runs in 11.048 seconds on my 2.66 GHz i7 system. SHAfile needs 2.741 seconds
>> > to process 385,241,618 bytes (64.9.. 50 MB/s/GHz). Hopefully your fix of 15 PICK
>> > will create additional room for speedup.
>> [..]
> You may get a 3-5% speed increase using these better versions of 'UpDateHash.
> Use the one the works the best. With VFX the first version takes 85 bytes and the
> 2nd 77 bytes, but the first one is faster.
> If you want even more speed unroll the loop and do it explicitly.
The speed variation between runs is much larger than the improvement.
If there is any, it is probably around 1%. The code is indeed much shorter.
-marcel
-- ------------------------------------------------------------------
: UpDateHash ( a b c -- ) \ Update hash values and load arrays with new values
8 0 DO DUP >R @ SWAP DUP >R @ + DUP \ Compute updated hash subvalue
R@ ! OVER ! CELL+ R> CELL+ R> CELL+ \ Store updated hash subvalue
LOOP 3DROP ; \ Clear stack when done
FORTH> ' updatehash idis
$0140BA00 : [trashed]
$0140BA0A mov rcx, 8 d#
$0140BA11 xor rbx, rbx
$0140BA14 call (DO) offset NEAR
$0140BA1E nop
$0140BA1F nop
$0140BA20 pop rdi
$0140BA21 mov rax, [rbx] qword
$0140BA24 add rax, [rdi] qword
$0140BA27 mov [rdi] qword, rax
$0140BA2A pop rdx
$0140BA2B mov [rdx] qword, rax
$0140BA2E lea rax, [rdx 8 +] qword
$0140BA32 push rax
$0140BA33 lea rdi, [rdi 8 +] qword
$0140BA37 push rdi
$0140BA38 lea rbx, [rbx 8 +] qword
$0140BA3C add [rbp 0 +] qword, 1 b#
$0140BA41 add [rbp 8 +] qword, 1 b#
$0140BA46 jno $0140BA20 offset NEAR
$0140BA4C add rbp, #24 b#
$0140BA50 pop rdi
$0140BA51 pop rax
$0140BA52 ;
: UpDateHash ( h[h] -) \ Update hash values: SHAsh(i) = SHAval(i) = SHAval(i-1) + H[H](i-1)
8 0 DO DUP @ I CELLS DUP >R SHAval + TUCK +! \ Compute updated hash subvalue
@ SHAsh R> + ! CELL+ LOOP DROP \ Store updated hash subvalue
;
FORTH> ' updatehash idis
$0140BA00 : [trashed]
$0140BA0A mov rcx, 8 d#
$0140BA11 xor rbx, rbx
$0140BA14 call (DO) offset NEAR
$0140BA1E nop
$0140BA1F nop
$0140BA20 mov rdi, [rbp 0 +] qword
$0140BA24 mov rax, [rbx] qword
$0140BA27 add [rdi*8 $01401720 +] qword, rax
$0140BA2F mov rax, [rdi*8 $01401720 +] qword
$0140BA37 mov [rdi*8 $01401770 +] qword, rax
$0140BA3F lea rbx, [rbx 8 +] qword
$0140BA43 add [rbp 0 +] qword, 1 b#
$0140BA48 add [rbp 8 +] qword, 1 b#
$0140BA4D jno $0140BA20 offset NEAR
$0140BA53 add rbp, #24 b#
$0140BA57 ;
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-02 23:48 +0200
Re: SHA-512 jzakiya@gmail.com - 2012-12-07 14:47 -0800
Re: SHA-512 Coos Haak <chforth@hccnet.nl> - 2012-12-08 00:49 +0100
Re: SHA-512 jzakiya@gmail.com - 2012-12-07 16:54 -0800
Re: SHA-512 Coos Haak <chforth@hccnet.nl> - 2012-12-08 18:21 +0100
Re: SHA-512 jzakiya@gmail.com - 2012-12-08 18:36 -0800
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-09 09:14 +0200
Re: SHA-512 jzakiya@gmail.com - 2012-12-09 17:23 -0800
Re: SHA-512 jzakiya@gmail.com - 2012-12-09 17:29 -0800
Re: SHA-512 jzakiya@gmail.com - 2012-12-09 20:46 -0800
Re: SHA-512 m.a.m.hendrix@tue.nl - 2012-12-10 03:53 -0800
Re: SHA-512 jzakiya@gmail.com - 2012-12-10 13:05 -0800
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-10 23:17 +0200
Re: SHA-512 jzakiya@gmail.com - 2012-12-13 06:30 -0800
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-13 21:33 +0200
Re: SHA-512 jzakiya@gmail.com - 2012-12-13 19:38 -0800
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-14 22:52 +0200
Re: SHA-512 jzakiya@gmail.com - 2012-12-14 16:39 -0800
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-15 19:11 +0200
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-16 16:00 +0200
Re: SHA-512 jzakiya@gmail.com - 2012-12-16 17:33 -0800
Re: SHA-512 jzakiya@gmail.com - 2012-12-16 22:35 -0800
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-17 10:14 +0200
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-17 10:51 +0200
Re: SHA-512 jzakiya@gmail.com - 2012-12-17 09:13 -0800
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-17 22:24 +0200
Re: SHA-512 jzakiya@gmail.com - 2013-01-15 20:38 -0800
Re: SHA-512 jzakiya@gmail.com - 2013-01-15 20:54 -0800
Re: SHA-512 Howerd <howerdo@yahoo.co.uk> - 2012-12-13 13:06 -0800
Re: SHA-512 Howerd <howerdo@yahoo.co.uk> - 2012-12-13 13:03 -0800
Re: SHA-512 mhx@iae.nl (Marcel Hendrix) - 2012-12-08 22:08 +0200
csiph-web