document manual hash generation
This commit is contained in:
parent
b3fd037cd9
commit
ad5cd4c820
1 changed files with 16 additions and 0 deletions
16
README.md
16
README.md
|
@ -24,6 +24,22 @@ PN532: No response from PN532!
|
|||
$
|
||||
```
|
||||
|
||||
## scanning new cards with a phone app
|
||||
|
||||
get a phone with nfc and the "nfc tools" app installed, scan card, look for "serial number", get first four bytes of that, use following code:
|
||||
|
||||
```
|
||||
# assumes card serial number 0x13121337 and pin 2137
|
||||
import hashlib
|
||||
def generate_hash(card_uid, pin):
|
||||
card_uid = bytes(reversed(card_uid[:4])).hex()
|
||||
s = "{:08x}:{}".format(int(pin), card_uid)
|
||||
hash=hashlib.sha256(s.encode('ascii')).digest().hex()
|
||||
return hash
|
||||
|
||||
generate_hash([0x13,0x12,0x13,0x37],bytearray(source=[ord('2'),ord('1'),ord('3'),ord('7')]))
|
||||
```
|
||||
|
||||
## syncing data from LDAP
|
||||
|
||||
big TODO; currently, you need to:
|
||||
|
|
Loading…
Reference in a new issue