Skip to main content

ctypeslib converted libnfc and libfreefare with just enough of the interals to actually be usable.

sudo apt install libfreefare-dev
pip install pynfc
from pynfc import Nfc, Desfire, Timeout

n = Nfc("pn532_uart:/dev/ttyUSB0:115200")

DESFIRE_DEFAULT_KEY = b'\x00' * 8
MIFARE_BLANK_TOKEN = b'\xFF' * 1024 * 4

for target in n.poll():
    try:
        print(target.uid, target.auth(DESFIRE_DEFAULT_KEY if type(target) == Desfire else MIFARE_BLANK_TOKEN))
    except TimeoutException:
        pass

Release files for pynfc 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pynfc 0.1.1
File Size Uploaded
pynfc-0.1.1.tar.gz 12.2 kB Details

Release files / pynfc-0.1.1.tar.gz

Download URL pynfc-0.1.1.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dca9a7aa364d6bbfa4dc56afb13993263eb41a32f087205601f748ee593a6cac
BLAKE2b-256 checksum
How to use checksums
086329d09b71ad116e33e659846fabc4e6c662852c37e80d20737af990fb3688
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.0.4

1 release file

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page