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
| import sys, os | |
| import numpy | |
| from PIL import Image | |
| from PIL.ExifTags import TAGS | |
| def get_exif(file): | |
| try: | |
| with Image.open(file) as im: |
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
| require 'securerandom' | |
| require 'matrix' | |
| module RSA | |
| module Calculator | |
| def self.powmod(base, exp, mod) | |
| return 1 if exp == 0 | |
| exp.bit_length.times.inject(1) do |buf, i| | |
| (buf ** 2) * (base ** exp[exp.bit_length - 1 - i]) % mod | |
| end |
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
| module Binary | |
| # or MD5.module_eval(using Module.new{refine Class {~}...}) | |
| INTEGER_SIZE = 32 | |
| refine Integer do | |
| def bit_rotate(bit_width=INTEGER_SIZE,shift=1) | |
| raise ArgumentError if bit_width.negative? | |
| shift = shift % bit_width | |
| ((self << shift) + (self >> (bit_width - shift) & ((1 << shift) - 1))) & ((1 << bit_width) - 1) |
NewerOlder