Skip to content

Instantly share code, notes, and snippets.

View ysc3839's full-sized avatar

Richard Yu ysc3839

View GitHub Profile
@adoc
adoc / pkcs7.py
Last active July 25, 2021 09:46
#pkcs7.py3: Implementation of PKCS #7 padding. Based on: http://japrogbits.blogspot.com/2011/02/using-encrypted-data-between-python-and.html
"""
Python implementation of PKCS #7 padding.
RFC 2315: PKCS#7 page 21
Some content-encryption algorithms assume the
input length is a multiple of k octets, where k > 1, and
let the application define a method for handling inputs
whose lengths are not a multiple of k octets. For such
algorithms, the method shall be to pad the input at the
trailing end with k - (l mod k) octets all having value k -
@cuihaoleo
cuihaoleo / cdm-fio.py
Created June 8, 2020 19:36
Something like CrystalDiskMark
#!/usr/bin/env python3
import json
import subprocess
import tempfile
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--loops", type=int, default=5,
help="Number of runs for each test.")