This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' AES ECB | |
Call the AES_set_encrypt_key, AES_set_decrypt_key, and | |
AES_ecb_encrypt functions from the OpenSSL library | |
Uses info from /usr/include/openssl/aes.h | |
Also see https://boringssl.googlesource.com/boringssl/+/2490/include/openssl/aes.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' sha1_demo | |
An implementation of SHA-1 in pure Python 3 | |
Built from the pseudocode at | |
https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode | |
Written by PM 2Ring 2017.10.01 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' Testing a Bloom filter implementation | |
See https://en.wikipedia.org/wiki/Bloom_filter | |
Written by PM 2Ring 2017.09.29 | |
''' | |
from random import seed, randrange |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
''' iso_ellipse. An ellipse that touches an isoceles triangle at the | |
midpoint of its base and at a given distance on the sides. | |
The apex of the triangle is at the origin, with the triangle's axis | |
on the +X axis. The slopes of the equal sides are m and -m, | |
the "height" is V, so the other 2 vertices are at (V, mV) and (V, -mV). | |
We want an ellipse that's tangential to the triangle at (X, Y) and (X, -Y) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' algorithmx_spotit | |
Generate small Spot-It decks by brute force searching for | |
the exact cover of pairs of cards which share a symbol. | |
Uses Knuth's Algorithm X for the exact cover problem. | |
The Algorithm X code, using dicts instead of doubly-linked | |
circular lists was written by Ali Assaf. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' Case-insensitive string class | |
A string class that uses lower-case hashing and comparisons. | |
It also uses case-insensitive comparison when compared with | |
normal `str` strings. | |
CIStr defines all 6 rich comparison methods, although only | |
the `__eq__` method is needed for dictionary and set use. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' A Tkinter viewer for named PIL Images | |
Image windows can be iconified / deiconified individually via buttons | |
in the main viewer window, or iconified / deiconified en masse by | |
iconifying / deiconifying the main viewer window. | |
Written by PM 2Ring 2017.07.16 | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
''' Demonstrate the PIL .fromarray bitmap bug | |
PIL's Image.fromarray function has a bug with mode '1' images | |
See | |
https://stackoverflow.com/questions/2761645/error-converting-pil-bw-images-to-numpy-arrays | |
Written by PM 2Ring 2017.06.26 |