Skip to content

Instantly share code, notes, and snippets.

View shirriff's full-sized avatar

Ken Shirriff shirriff

View GitHub Profile
@shirriff
shirriff / password.c
Created January 4, 2018 02:33
Use brute force to crack the password on a Xerox Alto disk.
#include <stdint.h>
#include <stdlib.h>
#include <strings.h>
#include <stdio.h>
int64_t count = 0;
// Password vector from sys.boot. Must be big-endian.
// Disk 47
uint16_t passvec[] = {0xffff, 0xcfa7, 0x9f3d, 0x669a, 0xf2bb, 0xf193, 0x6d09, 0x4571, 0xe1d1};
@shirriff
shirriff / nopassword.py
Created January 4, 2018 02:31
Disable password protection on an Alto disk by zeroing out the password flag in sys.boot
# Disable password protection on an Alto disk by zeroing out the password flag in sys.boot
import sys
import subprocess
diskContents = None
# Get word at the word offset in the disk file
def getWord(wordOffset):
return ord(diskContents[2 * wordOffset]) + ord(diskContents[2 * wordOffset + 1]) * 256
@shirriff
shirriff / mathcrack.py
Last active February 17, 2019 17:42
Rapidly crack Xerox Alto disk passwords using a mathematical formula that reverses the password hash
# Crack Xerox Alto disk passwords using math.
import sys
def findPasswd(passvec):
# a and b are the salt values
a = (passvec[1] << 16) + passvec[2]
b = (passvec[3] << 16) + passvec[4]
if a == 0 or b == 0:
print 'No password'
@shirriff
shirriff / christmas_card.txt
Created December 7, 2017 20:05
Text file to generate a Christmas card on the IBM 1401
-
- *
- + XX
- + X XXXX
- + XXX XXXXX
- * XXXXXX XXXXXXX
- XX XXXXXXXXXXXXXXXXX
- XXXX XXXXXXXXXXXXXXXXXX
- * XXXXXX XXXXXXXXXXXXXXXXXXX
- XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@shirriff
shirriff / card.s
Created December 7, 2017 20:04
IBM 1401 assembly code to print a Christmas card
job card.s
ctl 6641
org 087
X1 dcw 000 * Index 1, pointer to text
dc 00
org 333
start sw 1
sbr x1, buf+80
rloop r * Read cards into page buffer
bce rhs, 1, -
@shirriff
shirriff / ac3.py
Created December 7, 2017 18:38
Create checksums for an air conditioner remote control
import re
# Each line is 3 bytes of input and the observed 1-byte checksum
data="""\
10100001 10010011 01100011 => 01110111
10100001 10010011 01100100 => 01110001
10100001 10010011 01100101 => 01110000
10100001 10010011 01100110 => 01110010
10100001 10010011 01100111 => 01110011
10100001 10010011 01101000 => 01111001
@shirriff
shirriff / ac2.py
Created December 7, 2017 18:37
Analyze air conditioner checksum by reversing bytes and summing nibbles.
import re
data="""\
10100001 10010011 01100011 => 01110111
10100001 10010011 01100100 => 01110001
10100001 10010011 01100101 => 01110000
10100001 10010011 01100110 => 01110010
10100001 10010011 01100111 => 01110011
10100001 10010011 01101000 => 01111001
10100001 10010011 01101001 => 01111000
@shirriff
shirriff / ac.py
Created December 7, 2017 18:31
Process air conditioner remote control data: find inputs differing in one bit and print the difference in the output.
import re
data="""\
10100001 10010011 01100011 => 01110111
10100001 10010011 01100100 => 01110001
10100001 10010011 01100101 => 01110000
10100001 10010011 01100110 => 01110010
10100001 10010011 01100111 => 01110011
10100001 10010011 01101000 => 01111001
10100001 10010011 01101001 => 01111000
@shirriff
shirriff / mandel.bcpl
Last active June 18, 2017 16:25
Mandelbrot set code for the Xerox Alto, written in BCPL.
get "streams.d"
external
[
Ws;
Wns;
MulFull;
DoubleAdd;
keys;
Gets;
]
@shirriff
shirriff / main.c
Last active March 16, 2024 13:51
Example code using a timer with the BeagleBone Black's PRU microcontroller. This code generates 5 pulses with 100ns width.
/*
* Demonstration of the BeagleBone's PRU, using a timer.
* Ken Shirriff, http://righto.com
*/
#include <stdint.h>
#define DELAY_NS 100 // Use 500000000 for 0.5 second delay
#define WRITE_PIN 15 /* P8_11, Ethernet output data, pr1_PRU0_pru_r30_15 */
// PRU Interrupt control registers