summaryrefslogtreecommitdiff
path: root/utilities/hammington2416.py
diff options
context:
space:
mode:
authorSebastian Muszytowski <sebastian@muszytowski.net>2016-01-27 22:06:03 +0100
committerSebastian Muszytowski <sebastian@muszytowski.net>2016-01-27 22:06:03 +0100
commitb07679771f1c59ed623ae5ad7f7baff5b0ba9b9e (patch)
tree3cd2aefa10060eb7ed066cbcdc6fa19716b4611c /utilities/hammington2416.py
parent420cb4b1b01166739d57d37c3b95e6b6391555d7 (diff)
removed obsolete code, added new blinkenrocket python suite
Diffstat (limited to 'utilities/hammington2416.py')
-rw-r--r--utilities/hammington2416.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/utilities/hammington2416.py b/utilities/hammington2416.py
deleted file mode 100644
index 8e60a33..0000000
--- a/utilities/hammington2416.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/python
-
-import sys
-
-_hammingCalculateParityLowNibble = [0, 3, 5, 6, 6, 5, 3, 0, 7, 4, 2, 1, 1, 2, 4, 7]
-_hammingCalculateParityHighNibble = [0, 9, 10, 3, 11, 2, 1, 8, 12, 5, 6, 15, 7, 14, 13, 4]
-
-def HammingCalculateParity128(byte):
- return _hammingCalculateParityLowNibble[byte&0x0F] ^ _hammingCalculateParityHighNibble[byte >> 4]
-
-def HammingCalculateParity2416(first, second):
- return HammingCalculateParity128(second) << 4 | HammingCalculateParity128(first)
-
-output = ""
-bytepos = 0
-oldbyte = None
-
-# Read bytewise
-f = open(sys.argv[1])
-for byte in f.read():
- output += byte
- oldbyte = byte
- bytepos += 1
- if bytepos == 2:
- bytepos = 0
- output += str(HammingCalculateParity2416(ord(oldbyte), ord(byte)))
-if bytepos == 1:
- output += "\x00"
- output += str(HammingCalculateParity2416(ord(oldbyte), ord("\x00")))
-
-print output \ No newline at end of file