[AccessD] OT(kinda): Crack Code

MartyConnelly martyconnelly at shaw.ca
Thu Mar 22 20:32:50 CDT 2007


 I played around with this last night and figured out it was based on 
some date in 1974
with AM and PM being indicated by last two characters and first 6 as seconds
from the start date whatever that is, still  it seems a little out as to 
accuracy


Here is some code I used from some old code, you want to switch
to Base 36 and omit 0 will alter some counters

Const hashFactor As Integer = 37
Const hashLength As Integer = 9

Function HashString(strHash As String) As Double
' Create Hash string for indexing using
'Base 37 Hash Value
' Convert
' spaces punctuation odd chars = 0
' numeric = 0 - 9                1-10
' alpha chars a-z A-Z            11-37
' only use lower case
'such that string "Ab-12" =
'      A           b          -          1          2
'  (11*37^4) + (12*37^3) + (0*37^2) + (2*37^1) + (3*37^0)
'The Hash Length is 9 so it fits a double without precision loss

Dim iStrLen As Integer
Dim decAsc As Double
Dim i As Integer
Dim strPad As Integer
Dim strToHash As String
HashString = 0

' convert to all lower case
strToHash = UCase(strHash)
iStrLen = Len(strToHash)

'pad out string to 9 chars with blanks
If iStrLen < hashLength Then
 For strPad = (iStrLen + 1) To hashLength
    strToHash = strToHash & " "
 Next
Else
' or just grab first nine chars of string
   If iStrLen > hashLength Then
     strToHash = Left(strToHash, hashLength)
   End If
End If

For i = 1 To hashLength
  decAsc = Asc(Right(strToHash, i))
  'convert all odd Ascii character values and punctuation to 0
  If (decAsc < 48) Or (decAsc >= 58) And (decAsc <= 64) _
     Or (decAsc > 91) Then
    decAsc = 0
  Else
     'numbers
    If (decAsc >= 48) And (decAsc <= 57) Then
       decAsc = decAsc - 47
     Else
     'letters
      If (decAsc >= 65) And (decAsc <= 91) Then
         decAsc = decAsc - 54
         ' 54 not 64 as want to start "A" as 11
        End If
     End If
  End If

  HashString = HashString + (decAsc * hashFactor ^ (i - 1))
Next

End Function

Sub unhash()
' H9WDH701
Dim total As Double
Dim mydate As Date
Dim days As Double
total = (2 * 37 ^ 0)
Debug.Print total
total = total + (0 * 37 ^ 1)
Debug.Print total
total = total + (7 * 37 ^ 2)
Debug.Print total
total = total + ((Asc("H") - 54) * 37 ^ 3)
Debug.Print total
total = total + ((Asc("D") - 54) * 37 ^ 4)
Debug.Print total
total = total + ((Asc("W") - 54) * 37 ^ 5)
Debug.Print total
total = total + (9 * 37 ^ 6)
Debug.Print total
total = total + ((Asc("H") - 54) * 37 ^ 7)
Debug.Print total
'mydate = total
days = total / (3600# * 24# * 365#)
Debug.Print "days=" & days
End Sub
Sub unhashA()
' H9WDH701
Dim total As Double
Dim mydate As Date
Dim days As Double
total = (2 * 36 ^ 0)
Debug.Print total
total = total + (0 * 36 ^ 1)
Debug.Print total
total = total + (7 * 36 ^ 2)
Debug.Print total
total = total + ((Asc("H") - 55) * 36 ^ 3)
Debug.Print total
total = total + ((Asc("D") - 55) * 36 ^ 4)
Debug.Print total
total = total + ((Asc("W") - 55) * 36 ^ 5)
Debug.Print total
total = total + (9 * 36 ^ 6)
Debug.Print total
total = total + ((Asc("H") - 55) * 36 ^ 7)
Debug.Print total
'mydate = total
days = total / (3600# * 24# * 365#)
Debug.Print "days=" & days
End Sub
Sub unhashB()
' H9WDH701 02/06/03 09:19:55 AM
'days=33.1225264776763
' 12/02/1974 10:45:12 PM
Dim total As Double
Dim mydate As Date
Dim days As Double

total = total + (7 * 36 ^ 0)
Debug.Print total
total = total + ((Asc("H") - 55) * 36 ^ 1)
Debug.Print total
total = total + ((Asc("D") - 55) * 36 ^ 2)
Debug.Print total
total = total + ((Asc("W") - 55) * 36 ^ 3)
Debug.Print total
total = total + (9 * 36 ^ 4)
Debug.Print total
total = total + ((Asc("H") - 55) * 36 ^ 5)
Debug.Print total
'mydate = total
days = total / (3600# * 24# * 365#)
Debug.Print "days=" & days
Debug.Print DateAdd("s", -total, Now)
End Sub

Sub unhashC()
'  H9WLA903=02/06/03 12:08:33 PM
'12/02/1974 7:59:40 PM
Dim total As Double
Dim mydate As Date
Dim days As Double

total = total + (9 * 36 ^ 0)
Debug.Print total
total = total + ((Asc("A") - 55) * 36 ^ 1)
Debug.Print total
total = total + ((Asc("L") - 55) * 36 ^ 2)
Debug.Print total
total = total + ((Asc("W") - 55) * 36 ^ 3)
Debug.Print total
total = total + (9 * 36 ^ 4)
Debug.Print total
total = total + ((Asc("H") - 55) * 36 ^ 5)
Debug.Print total
'mydate = total
days = total / (3600# * 24# * 365#)
Debug.Print "days=" & days
Debug.Print DateAdd("s", -total, Now)
End Sub
Sub test()
Dim date1 As Date
Dim date2 As Date
date1 = #2/6/2003 12:08:33 PM#
date2 = #2/6/2003 9:19:55 AM#

Debug.Print DateDiff("s", date1, date2)
date1 = #12/2/1974 7:59:40 PM#
date2 = #12/2/1974 10:45:12 PM#

Debug.Print DateDiff("s", date1, date2)
End Sub

Mark A Matte wrote:

> Tha might be what the guy meant by 'shift a bit or 2'.
>
> I'm running frequency distribution on each char...and 7th char is 0 
> everytime except for 2 times out of 500K...
>
> Thanks for the 'shift'  I'll move all calcs over to spaces...and see 
> what I get.
>
> Thanks,
>
> Mark A. Matte
>
>
>
>> From: "Gary Kjos" <garykjos at gmail.com>
>> Reply-To: Access Developers discussion and problem 
>> solving<accessd at databaseadvisors.com>
>> To: "Access Developers discussion and problem 
>> solving"<accessd at databaseadvisors.com>
>> Subject: Re: [AccessD] OT(kinda): Crack Code
>> Date: Thu, 22 Mar 2007 13:57:32 -0500
>>
>> If you use that logic and you forget about the rightmost two positions
>> - maybe an occurance number or something, you can get close....
>> H = 1027924991 +
>> 9 = 15116544
>> W = 1492992
>> D = 16848
>> H = 612
>> 7 = 7
>> ---------------------
>> 1044551995
>>
>> which translates to Thursday, February 06, 2003 11:19:55 AM
>>
>> 2 hours off?
>>
>> I haven't tried it for any others but that one seems pretty scary
>> close for the first one I tried.
>>
>> For example in your first example. H9WDH701 = 02/06/03 09:19:55 = that
>> translates to 1044523195 in UNIX time. According to the time
>> calculators I googled.
>>
>> On 3/22/07, Mark A Matte <markamatte at hotmail.com> wrote:
>> > Rocky,
>> >
>> > I've actually made some progress.  Last year I learned how to do 
>> Mayan Math
>> > and applied the logic as a counting system not 10 or 20 base...but 
>> 36...and
>> > after learning that this thing is counting seconds since 1/1/70 
>> 00:00:00...I
>> > assigned values to the numbers and letters. and started running 
>> some tests.
>> > 0=0,1=1,2=2...9=9,A=10,B=11...Z=35.
>> >
>> > This makes it a 36 base counting system...so you take the value of 
>> each
>> > position...calculate and add like below:
>> >
>> > 1st  ???
>> > 2nd  ???
>> > 3rd  Value*60466176
>> > 4th  Value*1679616
>> > 5th  Value*46656
>> > 6th  Value*1296
>> > 7th  Value*36
>> > 8th  Value
>> >
>> > So if you had 00bfk5t2...you math would be Value of third position
>> > ('B'11*60466176) added to each position calculated...so:
>> > 0's are 0...('B'11*60466176)
>> > +('F'15*1679616)+('K'20*46656)+('5'5*1296)+('T'29*36)+('2'2)
>> >
>> > Beginning of time for this count is 12/31/69 04:00:00 PM...if you 
>> do the
>> > calcs above you get 691262822...if you add this many seconds to the
>> > beginning time you get 11/27/91 9:27:02 AM...
>> >
>> > Which validates in the system.  The guy I talked to that help 
>> create it over
>> > 12 years ago...said he remembered something about haveing to 'shift 
>> a bit or
>> > 2'...but I didn't get much more from him...he just didn't remember the
>> > specifics.  The 1st and 2nd positions I am having issues with...if 
>> I try to
>> > calculate it out...I get crazy results...and also in the validation
>> > tool...with the above example it validated...but if I added a
>> > letter(00bfk5t2 changed to 0bbfk5t2)...just added value in second
>> > position...it would not accept it as valid???  This is probably 
>> what he was
>> > talking about"Shifting a bit or 2".
>> >
>> > Anyway...any thoughts?
>> >
>> > What info would your cousin need?
>> >
>> > Thanks,
>> >
>> > Mark A. Matte
>> >
>> > 
>

-- 
Marty Connelly
Victoria, B.C.
Canada




More information about the AccessD mailing list