Skip to content

Instantly share code, notes, and snippets.

View operator-DD3's full-sized avatar
:octocat:
solo artist

Jacob Gardner operator-DD3

:octocat:
solo artist
  • banishing dirgist
View GitHub Profile
@operator-DD3
operator-DD3 / spritz.lua
Created December 12, 2017 06:45
Spritz Encryption Routines
S = {}
i,j,k,z,a,v=0,0,0,0,0,0
w=1
N=2^9 --2^8 or 8bits
D=math.ceil(math.sqrt(N))
print("N:",N)
print("D:",D)
function InitializeState(N)
@operator-DD3
operator-DD3 / block.lua
Created November 29, 2017 08:54
New Hash
function log2 (x) return math.log(x) / math.log(2) end
function entropy (X)
local N, count, sum, i = X:len(), {}, 0
for char = 1, N do
i = X:sub(char, char)
if count[i] then
count[i] = count[i] + 1
else
count[i] = 1
@operator-DD3
operator-DD3 / MARSclock.lua
Created August 6, 2016 01:28
A simple function to calculate the Mars Sol Date (MSD) and the Coordinated Mars Time (MTC) from the current number of seconds since the UNIX epoch.
function mars_time()
local ms = os.time()*1000
local JDut = 2440587.5 + (ms /86400000)
local JDtt = JDut + (35 + 32.184) / 86400
local J2000 = JDtt - 2451545.0
local MSD = ((J2000 - 4.5)/1.027491252) + 44796 - 0.00096
local MTC = (24 * MSD) % 24
local h = math.floor(MTC)
local m = math.floor((MTC - h)*60)
local s = math.floor((MTC - h - (m/60))*60*60)
@operator-DD3
operator-DD3 / antivirus.lua
Last active August 4, 2016 22:17
A simple antivirus script that generates the md5 hash of a file and sends the hash to the malware hash database at cymru.com This depends on 'openssl'
function os.capture(cmd, raw)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then return s end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
@operator-DD3
operator-DD3 / 5-3.lua
Last active March 10, 2016 19:17
A concatenative programming language inspired by FORTH and implemented in Lua.
pc=1 --program counter
program = {} --array of words in program
dict = {} --dictionary of user defined words
prim = {} --language keywords
stack= {} --working stack
rstack = {} --2nd stack
mem = {} --memory
mode = "interpret"
alive = true --used for halting and error
c_word = ""
@operator-DD3
operator-DD3 / keybase.md
Created October 5, 2015 20:19
keybase proof

Keybase proof

I hereby claim:

  • I am operator-dd3 on github.
  • I am operatordd3 (https://keybase.io/operatordd3) on keybase.
  • I have a public key whose fingerprint is B606 50B2 AADE 7DB0 FE0A 840F F2A7 2DC0 2E8A 66CB

To claim this, I am signing this object:

@operator-DD3
operator-DD3 / noise.html
Created September 28, 2015 07:22
Noisy Television Screen Simulation. Tested on mobile.
<style type="text/css">
html, body, canvas {
height: 100%;
width: 100%;
border-radius: 16px;
}
body {
display: flex;
background: black;
}
@operator-DD3
operator-DD3 / matasano.lua
Created August 29, 2015 08:46
[Lua] CryptoPals 1st attempt
-- Matasano Crypto Challenge
--
-- Jacob Gardner 2014
-- Challenge 1 (Convert hex to base64)
test1 = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"
real1 = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"
@operator-DD3
operator-DD3 / Set1-2.lua
Created August 26, 2015 15:07
[Lua] CryptoPals Cipher Challenge 1-2
local index_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
function to_binary(integer)
local remaining = tonumber(integer)
local bin_bits = ''
for i = 7, 0, -1 do
local current_power = math.pow(2, i)
@operator-DD3
operator-DD3 / Set1-1.lua
Created August 26, 2015 15:04
[Lua] CryptoPals Cipher Challenge
local index_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
function to_binary(integer)
local remaining = tonumber(integer)
local bin_bits = ''
for i = 7, 0, -1 do
local current_power = math.pow(2, i)