Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mz
  Where is Mz?
 Metro Manila
 Philippines
 Mz
 Tags
Subject: The strength of Logarithm...
Thread ID: 50901 Message ID: 50901 # Views: 3 # Ratings: 0
Version: Unknown Category: Other
Date: Tuesday, September 07, 2004 4:06:53 AM         
   


hey guys my apology... been realy busy yesterday till 11pm.
and ive been nursing my baby daniel just this early morning... hmm...

its hard to be a father... really specially when you are a bad person (nah...) ;-)

anyway...

The CODE for the challenge shows the strength of LOGARITHM.

heres the code

*------------------------------------------------------------------------------
* filename: mzhash.prg
*    since: 8/30/04
*       by: MzDarkReligion
*------------------------------------------------------------------------------
PARAMETERS VStr, VGarbage

PRIVATE VStrLen, ICtr, RetHash, VSum, NewStr

NewStr = ''
RetHash = 0
VSum = 0
VStrLen = LEN(VStr)

IF LEN(VGarbage) < VStrLen
  VGarbage = REPLICATE(VGarbage,INT(VStrLen / LEN(VGarbage) + 1))  
  *--- Insert Garbage -------
  FOR ICtr = 1 TO VStrLen
    NewStr = NewStr + SUBSTR(VStr,ICtr,1) + SUBSTR(VGarbage,ICtr,1)
  ENDFOR
ELSE
  NewStr = VStr + VGarbage
ENDIF

VStrLen = LEN(NewStr)

FOR ICtr = 1 TO VStrLen
  *VSum = VSum + LOG(ASC(SUBSTR(NewStr,ICtr,1)) + 1) * LOG(ICtr^ICtr) * 051004
  VSum = VSum + (LOG(ASC(SUBSTR(NewStr,ICtr,1)) + 1) * 0510200405281975)
ENDFOR  

VSum = INT(VSum)

RetHash = PReverse(ALLTRIM(STR(VSum,64)))

*rethash = ALLTRIM(STR(vsum,16))

RETURN RetHash

*---------------------- Internal Procedures ------------------------------------

PROCEDURE PReverse
PARAMETERS VIStr

PRIVATE PCtr, HLen

HLen = LEN(VIStr)
VReverse = ''

FOR PCtr = 1 TO 10
  VReverse = VReverse + SUBSTR(VIStr,HLen - PCtr + 1,1)
ENDFOR 

RETURN VReverse


to get a hash given the two string we call:

MyCRC = mzhash('A','20040801')


which has the result of
0598583142


mathematically there is NO LOGARITHM of ZERO '0'

you might find an error if numeric 0 is passed in the LOG() function.

The very good thing about this is that there seems to be no pattern since we did a

1. data insertion (Just like 3DES algo and the Variants)
2. we do the string reverse which is "ABNORMAL" PALINDROME

anyway i hope youll benefit all for the SECURITY...

HEY ONE MORE THING....

If you wanna change the way the computation of the HASH, you could change the SEED namely the multiplier,

0510200405281975


changing this would change the RESULTS.

Enjoy guys! Sorry for my errors in the past and the previous days... hmm... fighting is not good... ;-)
(Slap! Slap! Slap! hey im punishing myself... so don't put me to jail for this.. he he .. just kidding man)

-Mz


ENTIRE THREAD

The strength of Logarithm... Posted by Mz @ 9/7/2004 4:06:53 AM
RE: The strength of Logarithm... Posted by Wild Fire @ 9/7/2004 4:23:00 AM
RE: The strength of Logarithm... Posted by Alexander Federizo @ 9/7/2004 4:56:54 AM
RE: The strength of Logarithm... Posted by Mz @ 9/7/2004 5:07:57 AM
RE: The strength of Logarithm... Posted by Alexander Federizo @ 9/7/2004 6:40:06 AM
RE: The strength of Logarithm... Posted by Mz @ 9/7/2004 7:00:06 AM
RE: The strength of Logarithm... Posted by Alexander Federizo @ 9/7/2004 7:23:24 AM
RE: The strength of Logarithm... Posted by Mz @ 9/10/2004 12:47:34 PM
RE: The strength of Logarithms... Posted by Alexander Federizo @ 9/10/2004 6:07:12 PM
RE: The strength of Logarithm... Posted by Boudewijn Lutgerink @ 9/10/2004 8:43:15 AM
An adhoc Article... mzhash Posted by Mz @ 9/10/2004 9:35:34 AM
RE: An adhoc Article... mzhash Posted by Alexander Federizo @ 9/10/2004 5:53:58 PM
RE: An adhoc Article... mzhash Posted by Mz @ 9/11/2004 4:30:58 AM
RE: An adhoc Article... mzhash Posted by Sergey Karimov @ 9/11/2004 5:10:55 AM
RE: An adhoc Article... mzhash Posted by Mz @ 9/11/2004 6:45:48 AM
RE: An adhoc Article... mzhash Posted by Mz @ 9/11/2004 7:00:53 AM
RE: An adhoc Article... mzhash Posted by Sergey Karimov @ 9/11/2004 3:20:46 PM
RE: An adhoc Article... mzhash Posted by Sergey Karimov @ 9/11/2004 3:42:35 PM
RE: An adhoc Article... mzhash Posted by Mz @ 9/12/2004 10:19:23 AM
RE: An adhoc Article... mzhash Posted by Sergey Karimov @ 9/12/2004 4:13:36 PM
RE: An adhoc Article... mzhash Posted by Mz @ 9/13/2004 3:19:33 AM
An approach for Intelectual Property Protection... Posted by Mz @ 9/11/2004 7:12:08 AM
RE: An approach for Intelectual Property Protec... Posted by Dale Dedoroy @ 9/13/2004 4:14:20 AM
RE: An approach for Intelectual Property Protec... Posted by Mz @ 9/13/2004 5:27:30 AM