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


Groups > comp.lang.forth > #17784

Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth

Newsgroups comp.lang.forth
Date 2012-11-30 13:56 -0800
References <e1b992f7-65c4-4115-9f80-10fb671d3763@googlegroups.com> <50b4c134.156405635@192.168.0.50> <7a6a5bbd-eb18-4618-a868-5d152fad0c4f@googlegroups.com> <50b7f8f2$0$11011$882e7ee2@usenet-news.net>
Message-ID <03ec3371-5b8b-46f2-9ebd-5cd46598a77d@googlegroups.com> (permalink)
Subject Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth
From Howerd <howerdo@yahoo.co.uk>

Show all headers | View raw


On Friday, November 30, 2012 1:08:18 AM UTC+1, Josh Grams wrote:
> Howerd wrote:
> 
> > SHA-256 is an ugly algorithm
> 
> 
> 
> What did you find ugly about it?  I just read up about the algorithm and
> 
> had a quick stab at implementing it, and it seemed very straightforward
> 
> to me...
> 
> 
> 
> http://qualdan.com/2012/11/29/SHA-256.fs
> 
> 
> 
> I wouldn't recommend it for serious use without some more work, but see
> 
> what you think of how it reads.
> 
> 
> 
> --Josh

Hi Josh,

Maybe ugly is too extreme a word - I was comparing it to the Tiny Encryption Algorithm in its Block XTEA form - http://www.movable-type.co.uk/scripts/tea-block.html, which is much simpler.

I like your implementation very much because there are no macros and no PICKs.

> I wouldn't recommend it for serious use without some more work
Alas it doesn't seem to work for strings above 64 cells, I think because of the way the source string is copied into a 64 cell buffer. Also I don't think the answer is correct... But these are minor complaints compared to the more elegant coding style - i.e. they could be fixed with a few evenings debugging.
Also your code seems to use one less buffer compared than those converted from C.

I think the use of a stack to store previous data may be faster then an offset into an array on x86, but in converting the C code the fast PUSH's and POP's may have been converted into PICK's. Likewise macros may work in harmony with a C compiler, but just slow a Forth compiler down.

I think this confirms that starting out from the spec is not all that easy... 

I don't have a lot of free time at the moment, but I would love to know how fast your code runs my test harness, if you can spare a few evenings :-)

Best regards,
Howerd

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


Thread

ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-11-20 22:32 -0800
  Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-22 22:53 +0000
    Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth ritaoakford@gmail.com - 2012-11-23 00:21 -0800
    Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-23 14:20 +0000
    Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2012-11-25 22:58 +0200
      Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-11-25 14:41 -0800
        Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2012-11-26 00:59 +0200
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-11-25 16:10 -0800
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-11-26 04:18 -0800
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-11-26 19:17 +0100
      Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-26 11:57 +0000
        Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-11-26 06:17 -0600
        Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth mhx@iae.nl (Marcel Hendrix) - 2012-11-26 23:22 +0200
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-27 13:33 +0000
        Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Fritz Wuehler <fritz@spamexpire-201211.rodent.frell.theremailer.net> - 2012-11-27 09:18 +0100
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Mark Wills <forthfreak@gmail.com> - 2012-11-27 01:08 -0800
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-27 11:18 +0000
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-27 16:32 +0000
            Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Fritz Wuehler <fritz@spamexpire-201211.rodent.frell.theremailer.net> - 2012-11-28 11:59 +0100
              Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-28 14:11 +0000
  Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-11-26 16:50 +0000
  Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth stephenXXX@mpeforth.com (Stephen Pelc) - 2012-11-27 13:36 +0000
    Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-11-28 14:31 -0800
      Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-11-28 14:36 -0800
      Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Josh Grams <josh@qualdan.com> - 2012-11-30 00:08 +0000
        Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-11-30 13:56 -0800
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Josh Grams <josh@qualdan.com> - 2012-12-01 16:02 +0000
            Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-12-01 13:54 -0800
              Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Josh Grams <josh@qualdan.com> - 2012-12-02 11:26 +0000
      Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-12 14:52 -0800
        Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-12-12 23:47 -0800
          Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-13 00:38 -0800
            Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-12-13 20:17 -0800
              Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-13 20:25 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-12-13 20:53 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-13 21:16 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-12-14 03:43 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-14 12:15 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-20 00:21 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-14 04:45 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Howerd <howerdo@yahoo.co.uk> - 2012-12-14 03:33 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-14 12:20 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-14 10:28 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-14 12:39 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-15 01:47 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-19 18:10 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-19 19:53 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-20 14:44 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-20 19:28 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-20 13:56 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-21 01:41 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-21 03:58 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-21 02:20 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-21 06:46 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-21 15:34 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-21 08:40 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-22 03:36 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-21 20:07 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-23 02:37 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-22 19:24 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-23 15:52 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-23 17:52 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-24 03:57 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-24 16:20 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-24 15:36 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-25 02:52 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-24 21:51 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-25 20:56 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Paul Rubin <no.email@nospam.invalid> - 2012-12-26 01:08 -0800
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-26 16:02 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth David Thompson <dave.thompson2@verizon.net> - 2012-12-31 02:48 -0500
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth kenney@cix.compulink.co.uk - 2012-12-24 03:20 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-22 03:24 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-23 01:24 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-23 04:59 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-23 17:32 +0100
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-12-23 11:28 -0600
                Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-12-24 00:30 +0100
  Re: ANN: SHA-256 Secure Hash Algorithm in ANS Forth jzakiya@gmail.com - 2012-12-07 14:27 -0800

csiph-web