Skip to content

Instantly share code, notes, and snippets.

View typelogic's full-sized avatar
🏹

typelogic typelogic

🏹
View GitHub Profile
https://asciinema.org/a/HnTiuY8IaT0sVNdxWoTRxRwnr
https://asciinema.org/a/0wh79AGcnphX5udt5m2H8rPRo
@typelogic
typelogic / Main.java
Created February 20, 2020 16:02
desfire plumbing
import org.idpass.offcard.misc.Dump;
import com.github.skjolber.desfire.ev1.model.DesfireApplication;
import com.github.skjolber.desfire.ev1.model.DesfireApplicationId;
import com.github.skjolber.desfire.ev1.model.DesfireTag;
import com.github.skjolber.desfire.ev1.model.command.DefaultIsoDepAdapter;
import com.github.skjolber.desfire.ev1.model.command.DefaultIsoDepWrapper;
import com.github.skjolber.desfire.ev1.model.file.StandardDesfireFile;
import com.github.skjolber.desfire.libfreefare.C;
@typelogic
typelogic / Main.java
Created February 20, 2020 10:07
via skjolber
import com.github.skjolber.desfire.ev1.model.command.DefaultIsoDepAdapter;
import com.github.skjolber.desfire.ev1.model.command.DefaultIsoDepWrapper;
import com.github.skjolber.desfire.libfreefare.MifareDesfire;
import com.github.skjolber.desfire.libfreefare.MifareTag;
import android.nfc.tech.IsoDep;
public class Main {
public static void main(String[] args) {
@typelogic
typelogic / virtual_pcd
Created February 7, 2020 20:52
virtual_pcd
Feb 08 02:58:18 ident pcscd[4059]: 00001807 hotplug_libudev.c:651:HPEstablishUSBNotifications() USB Device add
Feb 08 04:28:33 ident pcscd[4059]: 99999999 hotplug_libudev.c:645:HPEstablishUSBNotifications() USB Device removed
Feb 08 04:28:33 ident pcscd[4059]: 00097385 hotplug_libudev.c:645:HPEstablishUSBNotifications() USB Device removed
Feb 08 04:28:33 ident pcscd[4059]: 00000686 hotplug_libudev.c:645:HPEstablishUSBNotifications() USB Device removed
Feb 08 04:51:31 ident systemd[1]: Stopping PC/SC Smart Card Daemon...
Feb 08 04:51:31 ident pcscd[4059]: 99999999 pcscdaemon.c:193:signal_thread() Received signal: 15
Feb 08 04:51:31 ident pcscd[4059]: 00000011 pcscdaemon.c:213:signal_thread() Direct suicide
Feb 08 04:51:31 ident pcscd[4059]: 00000002 pcscdaemon.c:785:at_exit() cleaning /var/run/pcscd
Feb 08 04:51:31 ident systemd[1]: pcscd.service: Main process exited, code=exited, status=1/FAILURE
Feb 08 04:51:31 ident systemd[1]: pcscd.service: Failed with result 'exit-code'.
@typelogic
typelogic / keycard.log
Created February 7, 2020 20:24
status-im
02-08 03:54:54.997 26301 26301 I AwareBitmapCacher: init lrucache size: 2097152 pid=26301
02-08 03:56:39.180 26301 26381 D ZrHung.AppEyeUiProbe: restart watching
02-08 03:56:39.208 26301 26382 D mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
02-08 03:56:46.131 26301 26399 I NFCCardManager: tag connected
02-08 03:56:46.138 26301 26399 I MainActivity: idpass Applet selection successful
02-08 03:56:46.142 26301 26399 D CardChannel: COMMAND CLA: 00 INS: A4 P1: 04 P2: 00 LC: 09
02-08 03:56:46.214 26301 26399 D CardChannel: RESPONSE LEN: 84, SW: 9000
02-08 03:56:46.214 26301 26399 D CardChannel: -----------------------
02-08 03:56:46.401 26301 26399 I MainActivity: idpass Instance UID: 23b61b6f40ca673b9ea4899da4362388
02-08 03:56:46.401 26301 26399 I MainActivity: idpass Secure channel public key: 0437955e466ffe4947592ad3ac1263356a7b5ceac7bbc3df9bb022addf9a49f69395c3c4572d1f4ca6164a270e2f6ed4caf83ec0d9fd1ce547848c0a19327d
@typelogic
typelogic / tdes.md
Last active January 26, 2020 16:18
3des notes

27f114e2122ab24abe1b940b59401871 https://www.cs.sjsu.edu/~stamp/CS265/SecurityEngineering/chapter5_SE/tripleDES.html

Triple DES

Since DES uses a 56-bit key it is vulnerable to attack. Is it possible to use DES, but make the effective key length longer than 56 bits?

Suppose C = EK(P), where E is DES encryption of plaintext P with key K, and C is the resulting ciphertext. Let D be the corresponding decryption, so that P = DK(C).

The accepted way of making DES more secure is to use two keys, K1 and K2 in "EDE" mode

@typelogic
typelogic / bitcoin_ec_key_generation.py
Created January 25, 2020 06:44
cryptography:asymmetric:python
# Super simple Elliptic Curve Presentation. No imported libraries, wrappers, nothing.
# For educational purposes only. Remember to use Python 2.7.6 or lower. You'll need to make changes for Python 3.
# Original source: https://github.com/wobine/blackboard101/blob/master/EllipticCurvesPart4-PrivateKeyToPublicKey.py
# secp256k1 domain parameters
Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 -1 # The proven prime
Acurve = 0; # These two defines the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve
Bcurve = 7;
Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
Gy = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
@typelogic
typelogic / lazy.hs
Created January 24, 2020 09:16
lazy evaluation in haskell
f1 a = a + 1
f2 a b
| b == 0 = 5
| otherwise = a b
@typelogic
typelogic / gist:ecf7ed4beb36f1a716eaeafe219bee4b
Created January 8, 2020 09:58
Thou shalt not missed symbolic links
find -L . -type f -name *.so