|
Post by Pjot on Jul 3, 2013 19:52:22 GMT 1
Folks, I have posted my MD5 code here. BR, Peter
|
|
|
Post by bigbass on Jul 4, 2013 6:13:59 GMT 1
Hello Peter
I really like when people post code that was ported (with the source) as the MD5 is really something that forces you to follow a preset logic formula
seeing all the converted parts to BaCon is a wealth of information thank you for taking the challenge it is very helpful to see a working converted example and much time could be saved learning BaCon just by studying your example
Joe
-------------------------------------------------------------- there is a law of disorder an example if you took a book of 500 hundred pages organized correctly that werent glued together and dropped a page at a time from a tall building the chances are extremely high an ordered book would be reproduced at the bottom of the building
for me meaning you can have or gather together the correct information and still not be able to make use of the information because it is not logically organized in the one working final result there is an infinite number of ways to do it wrong but only one way to do it right and just seeing the right way speaks volumes --------------------------------------------------------------
|
|
|
Post by vovchik on Jul 4, 2013 15:00:03 GMT 1
Dear Joe,
And right you are. An old colleague of mine, a very talented theoretical physicist from CERN, once demonstrated to me how much greater the energy input is in the construction of a building than in its destruction by, say, a ball and chain. You hit the nail on the head.
With kind regards, vovchik
|
|
|
Post by bigbass on Jul 6, 2013 23:09:16 GMT 1
I didn't compete in the MD5 contest but there is still some work that could be done documenting some things so that this example MD5 code could help out others that would like to understand BaCon *This is from the MD5 BaCon version by Peter just getting the syntax right is a very big part of understanding how to port code I created a conversion table for C code to BaCon using his code it is much easier to understand by example sourceforge.net/p/baconproto/wiki/C%20to%20BaCon/if anyone would like to contribute some more lines please send me the code and I will add it to the conversion chart any help is much welcomed I would like to have a massive data base of converted lines but you have to start by taking a step Joe
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jul 6, 2013 23:50:10 GMT 1
Joe,
Why wouldn't the BaCon FOR/NEXT be the translation for the C for?
|
|
|
Post by bigbass on Jul 7, 2013 0:13:51 GMT 1
Hey jrs
Well you are right for should be ported to FOR/NEXT but in the code example I was attempting to document it was done with WHILE /WEND
C code snippet
for (new_len = initial_len + 1; new_len % (512/8) != 448/8; new_len++)
the above line is something you usually see all one long line but it was separated and replaced with WHILE /WEND
ported to BaCon snippet
new_len = initial_len + 1 WHILE new_len % (512/8) != 448/8 INCR new_len WEND
the usual for example
C code
/// break chunk into sixteen 32-bit words for (i = 0; i < 16; i++) w[i] = to_int32(msg + offset + i*4);
Ported to BaCon code
' break chunk into sixteen 32-bit words FOR i = 0 TO 15 w[i] = to_int32(msg + offset + i*4) NEXT i
I will edit the code for documentation so it is clearer thanks for commenting Joe
|
|