News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GLOBALLY UNIQUE properties

Started by ossama, December 12, 2007, 06:38:55 AM

Previous topic - Next topic

evlncrn8

not easily nope, even microsofts one is a mix of 8 or so components

Mark Jones

A simple way could be to XOR each byte of the string with a known byte-sequence.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

ossama

Quote from: Mark Jones on December 14, 2007, 07:01:02 PM
A simple way could be to XOR each byte of the string with a known byte-sequence.
is this operation reversible?

ossama

how can i get a double word number from many multi-byte sources (windows id, pci serials,....)and the the reverse (ie,from the hash i get those properties)
sorry, i am new in hash worls  :bg,
any simple examples to show how can one get a hash from NULL terminated string -for example)?

Adamanteus

For it is need to invent one function of pseudorandom generator, for example as Galua, and XOR string by it's return value iteratively  :8)

donkey

Quote from: Tedd on December 14, 2007, 01:01:49 PM
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProductID
contains the registration number for your windows installation (you can see it under "Registered to:" in the System Properties dialog.)
It should be unique for each windows cd (i.e. if you use the same cd on two machines, they will have the same id.)

Actually, all the CDs are pretty much the same with the exception of a few OEM specific additions. The product ID is derived from the registration code entered during the Windows installation process and would still be unique to each machine. Of course Windows versions prior to XP could be installed multiple times with the same key and that allows for a non-unique identifier though if you are only concerned about running exclusively on your machine you control the installation key so it is not a pressing issue (unless you have an illegal copy of Windows  :naughty: ), with XP and above this key can be assumed to hold a value that is globally unique to a particular system.

However, short of a hardware dongle any software based solution to this would be easily broken so it is at best only a hindrance for the casual user.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

ic2

While searching for more information about COM I came across this.  It's about hardware so it may be related to some of the questions here.  "Windows Management Instrumentation"

http://www.masm32.com/board/index.php?topic=2594.msg20533

Adamanteus

For cryptography reason exists key that changing from installation to installation, but it is :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid

ossama

i have read that one hash code can be derived from many diffrent sources,so if a program that will work on machine based on hash code,may run in other machine that its properties may generate the same hash,
so it will not solve the problem

Ehtyar

See here for an explanation, and here for some sources to get you started.

Hope this helps, Ehtyar.

donkey

Quote from: ossama on December 16, 2007, 11:15:01 AM
i have read that one hash code can be derived from many diffrent sources,so if a program that will work on machine based on hash code,may run in other machine that its properties may generate the same hash,
so it will not solve the problem

How many machines do you think this will actually run on ? SHA1 would be more than adequate to reduce the possiblities of a repeated hash to nearly nothing. The odds of 2 machines generating the same hash are less than significant. If you are looking to reduce the data to a useful size then a hash is the way to go and worrying about whether the remote possibility of 2 machines generating the same hash will occur is ludicrous. Who are you writing this for the CIA ? At any rate, here's an inplementation of the Windows crypto functions for generating a hash...

GetKey FRAME pszKey,pHashKey
uses edi,esi,ebx
LOCAL dwStatus :D
LOCAL bResult :D
LOCAL hProv :D
LOCAL hHash :D
LOCAL cbRead :D
LOCAL rgbHash[64] :B
LOCAL cbHash :D
LOCAL rgbDigits[16] :B

// Generate a 16 byte SHA HASH from the key
mov [rgbDigits],"0123"
mov [rgbDigits+4],"4567"
mov [rgbDigits+8],"89ab"
mov [rgbDigits+12],"cdef"

invoke szLen,[pszKey]
test eax,eax
jz >>.ERRORCONTEXT
mov [cbRead],eax

invoke CryptAcquireContext,offset hProv,NULL,NULL,PROV_RSA_FULL,CRYPT_VERIFYCONTEXT
test eax,eax
jz >>.ERRORCONTEXT

invoke CryptCreateHash,[hProv], CALG_SHA, NULL, NULL, offset hHash
test eax,eax
jz >>.ERRORHASH

invoke CryptHashData,[hHash], [pszKey], [cbRead], NULL
test eax,eax
jz >>.ERROROTHER

// The hash is created zero the key so it doesn't sit in memory
mov edi,[pszKey]
mov ecx,[cbRead]
xor eax,eax
rep stosb

mov D[cbHash],64
invoke CryptGetHashParam,[hHash], HP_HASHVAL, offset rgbHash, offset cbHash, NULL
test eax,eax
jz >>.ERROROTHER

// convert the hash to an SHA string using a lookup table
xor eax,eax
xor edx,edx
mov ebx,[pHashKey]
mov edi,offset rgbHash
mov ecx,[cbHash]
mov esi,offset rgbDigits
:
mov al,[edi]
shr al,4
mov dl,[esi+eax]
mov [ebx],dl
inc ebx
mov al,[edi]
and al,0fh
mov dl,[esi+eax]
mov [ebx],dl
inc edi
inc ebx
dec ecx
jnz <
mov B[ebx],0

invoke CryptDestroyHash [hHash]
invoke CryptReleaseContext, [hProv], NULL
xor eax,eax
ret

.ERROROTHER
invoke CryptDestroyHash [hHash]

.ERRORHASH
invoke CryptReleaseContext, [hProv], NULL

.ERRORCONTEXT
invoke VirtualFree,[pHashKey],NULL,MEM_RELEASE
xor eax,eax
dec eax
RET
ENDF
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

ossama

hi donkey,forget about CIA  :bg
here in algeria all we have the same windows cd key for all PCs we dont have microsoft division where we can buy a liscned copy of windows,so when i generate a hash from the windows key it will be the same in all of the PCs in algeria,
so i need other Globall Property to generate a hash from it,
thank you for the help