Proxmark developers community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

#1 2014-08-13 11:05:41

chick0n
Member
Registered: 2014-08-13
Posts: 5

RFID UID Calculator?

I know RFID has a Internal UID and this can be Converted in Various External UIDs.

Internal HEX 10 = 0102b0c1fd
Converted in:
IK2-Nummer DEZ 14 = 00004340105725
IK3-Nummer DEZ 15 = 000550830441407
ZK-Nummer DEZ 20 = 08000400001308031115
DEZ 8 = 11583997
DEZ 10 = 0045138429
DEZ 5.5 = 00688.49661
DEZ 3.5A = 001.49661
DEZ 3.5B = 002.49661
DEZ 3.5C = 176.49661


Is it possible for Example, to Convert the "ZK Nr." Back to the Internal UID?

Thanks!!

Offline

#2 2014-08-13 12:29:54

iceman
Administrator
Registered: 2013-04-25
Posts: 4,849
Website

Re: RFID UID Calculator?

It would be nice to have all the UID transformations back and forward...
Does someone have the definitions regarding the conversions above?


冰人

modhex(hkhehghthbhudcfcdchkigiehgduiehg)

Offline

#3 2014-08-13 15:38:33

chick0n
Member
Registered: 2014-08-13
Posts: 5

Re: RFID UID Calculator?

Ok, the problem is, I want to Clone a Honeywell IdentKey3 Keyfob.

I found out this is EM41xx Chip based.

EM41xx has Internal 10 HEX Code.

But this Honeywell System uses this 20 Digit ZK Nr. (Called CC NR. in English?). So it would be nice to Convert the ZK back to Hex, to Clone the fob. smile


I found this Excel Converter Script:

http://i-keys.de/download_free/Hexa.xls


But it cant Convert ZK.

Maybe this is Honeywell propietary Algorhitm?

Offline

#4 2014-08-13 21:14:14

asper
Contributor
Registered: 2008-08-24
Posts: 1,409

Re: RFID UID Calculator?

I found some correlations but more examples are needed; my preliminary (very simple) analysis suggests that it will be probably impossible to obtain back the full 10 HEX ID starting from the already converted value, only a part should be "recoverable". If you can provide more examples I can try to investigate deeper and dismatle this supposition.

Last edited by asper (2014-08-13 21:15:14)

Offline

#5 2014-08-14 07:33:59

chick0n
Member
Registered: 2014-08-13
Posts: 5

Re: RFID UID Calculator?

I found Another Example:

Original HEX 10 = 0400F5B541
umgerechnet in:
IK2-Nummer DEZ 14 = 00017195971905
IK3-Nummer DEZ 15 = 000550830441407
ZK-Nummer DEZ 20 = 02000000101510130802
DEZ 8 = 16102721
DEZ 10 = 0016102721
DEZ 5.5 = 00245.46401
DEZ 3.5A = 004.46401
DEZ 3.5B = 000.46401
DEZ 3.5C = 245.46401


http://www.i-keys.de/ claims, they can Convert ZK back to HEX. For 0,70€ per piece. wink

I sent them some ZK's...

Offline

#6 2014-08-14 16:28:45

asper
Contributor
Registered: 2008-08-24
Posts: 1,409

Re: RFID UID Calculator?

Mmmm there must be an error... IK3-Nummer DEZ 15 it's the same as the other one you posted earlier... are you sure other values are correct ?

Offline

#7 2014-08-14 17:11:21

chick0n
Member
Registered: 2014-08-13
Posts: 5

Re: RFID UID Calculator?

No im not sure...

just took them off i-keys.de

But I will send you my results from i-keys.

Offline

#8 2014-08-14 20:06:33

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

it is possible to translate the ZK number to the original.
below is how it appears to be originally calculated:

Reverse each nibble:
0102B0C1FD --->  10200B1CDF
reverse the binary of each nibble: 0001 ---> 1000 = 8...
10200B1CDF --->  80400D83BF
convert each hex nibble to a 2 digit decimal number:
80400D83BF --->  08000400001308031115

enjoy.

Offline

#9 2014-08-14 20:14:29

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

Based on the first sample above I'd assume the remainder of the calculations are as follows:

11583997        = DEZ 8             = last 6 hex converted to dec	
0045138429      = DEZ 10            = last 8(7?) hex converted to dec
00688.49661     = DEZ 5.5           = digits 4-7 hex converted to dec "." last 4 hex converted to dec	
001.49661       = DEZ 3.5A          = first 2 hex digits "." last 4 converted to dec	
002.49661       = DEZ 3.5B          = Digits 3,4 "." last 4 converted to dec
176.49661       = DEZ 3.5C          = digits 5,6 hex converted to dec "." last 4 hex converted to dec
00004340105725  = IK2-Nummer DEZ 14 = entire hex converted to dec	
000550830441407 = IK3-Nummer DEZ 15 = reverse the binary for each byte and convert to decimal

EDIT: fixed DEZ 5.5 (had digits 3-6 should have been 4-7 at beginning)
EDIT: fixed DEZ 3.5C (had digits 4,5 should have been 5,6 at beginning) Thanks Asper!

Last edited by marshmellow (2014-08-19 15:29:08)

Offline

#10 2014-08-14 21:03:26

chick0n
Member
Registered: 2014-08-13
Posts: 5

Re: RFID UID Calculator?

Awesome dude... Thanks  cool


I checked with Windows Calculator...it works:

ZK to HEX:

convert each 2 digit decimal number to hex:
08000400001308031115 > 80400D83BF

convert each digit from hex to binary, then reverse binary and convert to hex again: 8 > 1000 = 0001
80400D83BF > 10200B1CDF

D > 1101 > 1011 > B
3 > 0011 > 1100 > C
B > 1011 > 1101 > D

Reverse each nibble:
10200B1CDF > 0102B0C1FD

Offline

#11 2014-08-15 05:37:08

asper
Contributor
Registered: 2008-08-24
Posts: 1,409

Re: RFID UID Calculator?

Great work marshmellow wink I was near, you were faster  tongue

Offline

#12 2014-08-18 15:40:34

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

smile

Offline

#13 2014-08-18 21:19:22

asper
Contributor
Registered: 2008-08-24
Posts: 1,409

Re: RFID UID Calculator?

There is a little error:
DEZ 3.5C          = digits 5,6 hex (and not 4,5) converted to dec "." last 4 hex converted to dec
tongue

Offline

#14 2014-08-18 21:28:05

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

You are correct. I will edit my post above.  I had a typo when transferring the info from my excel sheet.  tongue

Offline

#15 2014-08-19 14:38:45

asper
Contributor
Registered: 2008-08-24
Posts: 1,409

Re: RFID UID Calculator?

I have a problem decoding to dec the IK3 DEZ15, in excel i receive this value -5,48681E+11    for 0102b0c1fd ID (revesed = 80400D83BF), i think the problem is that the number decoded to dec is too long... any help with excel sheet ?

Offline

#16 2014-08-19 14:59:22

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

you can build a function (macro) to calculate it and return a string.  I could help if I had the sheet.

Offline

#17 2014-08-19 15:01:11

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

the ' will also change numbers to text and prevent auto formatting.  but I believe excel can only handle a 15 digit number max then it will round up (which is why I sometimes use vba functions and return text to the cell)

Offline

#18 2014-08-19 15:04:06

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

you can also do a custom formatted and put 0 (or 15 zeros if you want leading zeros) in for the format  (it should remove scientific notation)

Last edited by marshmellow (2014-08-19 15:04:57)

Offline

#19 2014-08-19 15:58:23

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

the issue is the hex2dec function in excel treats certain ranges of hex values as negative numbers
to avoid this you have to create your own function to change the hex 2 dec. 
like: (probably other ways to do this but..)

Public Function Hex2DecStr(x As String, Optional Length As Integer = 0) As String
    Hex2DecStr = CDec("&H" & x)
    If Length > Len(Hex2DecStr) Then
        Hex2DecStr = Left("00000000000000000", Length - Len(Hex2DecStr)) & Hex2DecStr
    End If
End Function

Offline

#20 2014-08-19 18:32:53

asper
Contributor
Registered: 2008-08-24
Posts: 1,409

Re: RFID UID Calculator?

Here it is my sheet to automatically decode any Hex 10 digit number (mainly used for EM4100); feel free to use and modify at your pleasure and also add functions and other decoding patterns when you discoverw them ! It also ancode the T55x7 block0 (configuration)  wink

Credits given in the sheet !

Last edited by asper (2014-08-19 18:36:31)

Offline

#21 2014-08-19 19:48:44

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

Here is a slightly revised version.  smile

Offline

#22 2014-08-21 06:51:00

asper
Contributor
Registered: 2008-08-24
Posts: 1,409

Re: RFID UID Calculator?

Thank you !

Offline

#23 2014-10-13 17:02:48

MilkThief
Contributor
Registered: 2014-04-11
Posts: 104

Re: RFID UID Calculator?

It would be wonderful if that would be integrated in a "verbose" version of the "lf em4x em410xwatch" / "lf em4x em410xsim" command...
That way we would be able to emulate a broken tag reading the printed serial number...

Offline

#24 2014-10-17 03:39:36

marshmellow
Moderator
From: US
Registered: 2013-06-10
Posts: 2,228

Re: RFID UID Calculator?

Imo .Too many possible calculations, many of which don't represent the entire EM ID.

Offline

#25 2014-12-10 00:50:05

MilkThief
Contributor
Registered: 2014-04-11
Posts: 104

Re: RFID UID Calculator?

Not exactly what you are looking for, but a great tool that nobody should miss...
HERE

Offline

#26 2014-12-10 12:42:13

iceman
Administrator
Registered: 2013-04-25
Posts: 4,849
Website

Re: RFID UID Calculator?

Just for the fun of it.

I built a WebService which you can call to decode a Em41xx tag,   either  you call it with sniffed hexvalues or the command "data mandemod" output (binary string)

http://www.icesql.se/Services/Em41xxDec … ervice.svc


冰人

modhex(hkhehghthbhudcfcdchkigiehgduiehg)

Offline

#27 2018-06-16 02:56:18

crazy_coloradoan
Contributor
Registered: 2018-06-12
Posts: 2

Re: RFID UID Calculator?

Hey, sorry to dredge up an old thread, but since I found it thru google, maybe other people are finding it too...

Anyway, here is a version of Marshmallow's conversion procedure from ^above, ported to javascript for google sheets.

Just open a google sheet, go to Tools > "Script Editor" and paste in the following code. Then you'll be able to use the formulas zk_to_hex() and hex_to_zk() anywhere in your sheet.

The input is a 20-digit decimal number, that some RFID companies calla "ZK code". The output is a 10-digit hex code. The process works in both directions.

function zk_to_hex(value) {
return value
  .match(/\d{2}/g)
  .map(dec2hex)
  .map(hex2bin)
  .map(reverse)
  .map(bin2hex)
  .join('')
  .toUpperCase()
  .match(/[0-9A-F]{2}/g)
  .map(reverse)
  .join('')
}

function hex_to_zk(value) {
return value
  .toUpperCase()
  .match(/[0-9A-F]{2}/g)
  .map(reverse)
  .join('')
  .match(/[0-9A-F]{1}/g)
  .map(hex2bin)
  .map(reverse)
  .map(bin2dec)
  .join('')
}

function reverse(value) {
  return value.split('').reverse().join('')
}

function dec2hex(value) {
  return parseInt(value, 10).toString(16)
}

function bin2hex(value) {
  return parseInt(value, 2).toString(16)
}

function hex2bin(value) {
  return paddingLeft(parseInt(value, 16).toString(2), '0000')
}

function dec2bin(value) {
  return paddingLeft(parseInt(value, 10).toString(2), '0000')
}

function bin2dec(value) {
  return paddingLeft(parseInt(value, 2).toString(10), '00')
}

function hex2dec(value) {
  return paddingLeft(parseInt(value, 16).toString(10), '00')
}

function paddingLeft(value, padding) {
  return (padding + value).slice(-padding.length)
}

Offline

Board footer

Powered by FluxBB