Link to home
Start Free TrialLog in
Avatar of David Gerler
David GerlerFlag for United States of America

asked on

use vbscript combine several numbers bitwise to get a 64 bit number

I have this vb.net code that is used to produce a 64 bit number to uniquely identify an item. The problem is that I now need to do the same thing in a classic asp page. Can it be done? If so, how?

            '   Store Years 1900 To 2155 In Eight Bits
            Dim iYear As Long = CLng((breakout.parsedDate.Year - 1900) And &HFF)

            '   Store Months In 4 Bits (1-12 Fits In 0 - 15)
            Dim iMonth As Long = CLng(breakout.parsedDate.Month And &HF)

            '   Store Days In 5 Bits (0-31)
            Dim iDay As Long = CLng(breakout.parsedDate.Day And &H1F)

            '   Store Numbers 0 To 131071 Taking Up 17 Bits
            Dim iStore As Long = CLng(breakout.store And &H1FFFF)


            '   Register Numbers 0 To 999 Taking Up Ten Bits
            Dim iRegister As Long = CLng(breakout.register And &H3FF)

            '   Ticket Numbers 0 To 131071 Taking Up 17 Bits
            Dim iTicket As Long = CLng(breakout.ticket And &H1FFFF)

            '   Shift Items To Their Proper Offset
            iStore = iStore << 17
            iRegister = iRegister << 34
            iYear = iYear << 44
            iMonth = iMonth << 52
            iDay = iDay << 56

            '   "And Them Together"
            Dim iHash As Long = iTicket Or iStore Or iRegister Or iYear Or iMonth Or iDay
            Return iHash.ToString
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David Gerler

ASKER

Thanks anyway. I guess I'll just have to do it in a dll and return a string.
I'll make the number in a dll and return a string to the asp. Thanks anyway.