Example #1
0
def createMod512LookupTable(encoding):
	table = LookupTable()

	points = generatePointsMatrix(24)
	baseBitStrings = generateBaseBitStringMatrixMod512()
	
	if encoding == LINEAR:
		linearList = BG.generateBitList(9)
		index = 0
		for i in range(0, 24):
			for j in range(0, 24):
				if baseBitStrings[i][j] != None:
					baseBitStrings[i][j] = BSH.charListToString(linearList[index])
					index += 1

	else:
		fillInBitStringMatrixMod512(baseBitStrings)
		replaceWithGrayCodeBinary(baseBitStrings, 9)
		mirrorTopLeftQuadrant(baseBitStrings)
		
	for i in range(0, 24):
		for j in range(0, 24):
			if baseBitStrings[i][j] != None:
				table.add(baseBitStrings[i][j], points[i][j])	 

	return table
Example #2
0
def createMod1024LookupTable(encoding):
	table = LookupTable()

	points = generatePointsMatrix(32)
	bitMatrix = generateSquareMatrix(10, encoding)

	for i in range(0, 32):
		for j in range(0, 32):
			table.add(bitMatrix[i][j], points[i][j])

	return table
    def InitMotors(self):

        # Motor Controllers
        # Pins - PWM, FWD, REV
        #self._motorLookupV = [0, 12]
        #self._motorLookupPWM = [0, 100]
        self._motorLookupV = [0.0, 1.0, 1.1, 10.4, 11.0, 11.5, 11.8, 12.0]
        self._motorLookupPWM = [0.0, 1.0, 2.0, 80.0, 85.0, 90.0, 95.0, 100.0]

        self._motorLookup = LookupTable(\
            self._motorLookupV, self._motorLookupPWM)

        self._motorLeft = MotorControl_pigpio(\
            self._pi, 13, 19, 26)
        self._motorRight = MotorControl_pigpio(\
            self._pi, 16, 20, 21)

        self._motorLeft.SetVoltageLookupTable(\
            self._motorLookup)
        self._motorRight.SetVoltageLookupTable(\
            self._motorLookup)

        # Motor Encoders
        # TODO

        return
Example #4
0
def createMod4GrayLookupTable():
	table = LookupTable()
	values = BG.generateBitList(2)

	stringValues = []
	for value in values: 
		stringValues.append(BSH.charListToString(Encoder.convertToGray(value)))

	points = generatePointsMatrix(2)
	nextString = 0
	for i in range(0, 2):
		for j in range(0, 2):
			table.add(stringValues[nextString], points[i][j])
			nextString += 1

	return table
Example #5
0
def createMod4GrayLookupTable():
	table = LookupTable()
	table.add("00", Point(1,0))
	table.add("01", Point(0,1))
	table.add("11", Point(-1,0))
	table.add("10",Point(0,-1))
	return table
Example #6
0
def createMod32LookupTable(encoding):
	table = LookupTable()

	points = generatePointsMatrix(6)
	baseBitStrings = generateBaseBitStringMatrixMod32()
	
	if encoding == LINEAR:
		linearList = BG.generateBitList(5)
		index = 0
		for i in range(0, 6):
			for j in range(0, 6):
				if baseBitStrings[i][j] != None:
					baseBitStrings[i][j] = BSH.charListToString(linearList[index])
					index += 1

	else:
		linearList = BG.generateBitList(3)
		grayList = []
		for value in linearList:
			grayList.append(BSH.charListToString(Encoder.convertToGray(value)))

		baseBitStrings[0][0] = None
		baseBitStrings[0][1] = grayList[4]
		baseBitStrings[0][2] = grayList[3]
		baseBitStrings[1][0] = grayList[5]
		baseBitStrings[1][1] = grayList[6]
		baseBitStrings[1][2] = grayList[7]
		baseBitStrings[2][0] = grayList[2]
		baseBitStrings[2][1] = grayList[1]
		baseBitStrings[2][2] = grayList[0]

		# With QAM levels that are an odd power of 2 it is no longer possible
		# to arrange the values such that no 2 differ by more than 1 bit. The 
		# above pattern is the best that can be done. It gives 8 adjacent pairs
		# that differ by more than 1 bit. This pattern is scaled up to be used 
		# in 128 and 512 QAM. 
		mirrorTopLeftQuadrant(baseBitStrings)

	for i in range(0, 6):
		for j in range(0, 6):
			if baseBitStrings[i][j] != None:
				table.add(baseBitStrings[i][j], points[i][j])	 

	return table
Example #7
0
def createMod8LookupTable(encoding):
	table = LookupTable()
	values = BG.generateBitList(3)

	stringValues = []
	for value in values: 
		if encoding == LINEAR:
			stringValues.append(BSH.charListToString(value))
		else:
			stringValues.append(BSH.charListToString(Encoder.convertToGray(value)))

	bitMatrix = []

	nextRow = []
	nextRow.append(stringValues[0])
	nextRow.append(stringValues[1])
	nextRow.append(stringValues[2])
	bitMatrix.append(nextRow)

	nextRow = []
	nextRow.insert(0, stringValues[3])
	nextRow.insert(0, None)
	nextRow.insert(0, stringValues[7])
	bitMatrix.append(nextRow)

	nextRow = []
	nextRow.append(stringValues[6])
	nextRow.append(stringValues[5])
	nextRow.append(stringValues[4])
	bitMatrix.append(nextRow)

	points = generatePointsMatrix(3)

	for i in range(0,3):
		for j in range(0,3):
			table.add(bitMatrix[i][j], points[i][j])
			
	return table
Example #8
0
def createMod2LookupTable():
	table = LookupTable()
	table.add('0', Point(-1,0))
	table.add('1', Point(1,0))
	return table
Example #9
0
def createMod8GrayLookupTable():
	table = LookupTable()
	table.add("000", Point(1,0))
	table.add("001", Point(0.7071, 0.7071))
	table.add("101", Point(0, 1))
	table.add("100", Point(-0.7071, 0.7071))
	table.add("110", Point(-1, 0))
	table.add("111", Point(-0.7071, -0.7071))
	table.add("011", Point(0,-1))
	table.add("010", Point(0.7071, -0.7071))
	return table
Example #10
0
def createMod8LinearLookupTable():
	table = LookupTable()
	table.add('000', Point(1,0))
	table.add('001', Point(0.7071, 0.7071))
	table.add('010', Point(0, 1))
	table.add('011', Point(-0.7071, 0.7071))
	table.add('100', Point(-1, 0))
	table.add('101', Point(-0.7071, -0.7071))
	table.add('110', Point(0, -1))
	table.add('111', Point(0.7071, -0.7071))
	return table
import telnetlib
import hashlib
import sys
sys.path.append('hashlookup')
from LookupTable import LookupTable

server = "hackyeaster.hacking-lab.com"
port = 8888

# start the match
tn = telnetlib.Telnet(server, port)
print tn.read_until("Ready for the game?")
tn.write("y\n")
print tn.read_until("Let's go!\n")

l = LookupTable('sha2-256', 'wordlist-sha2-256.idx', 'wordlist.txt')

# play the game
while True:
    # get it
    h = tn.read_until('\n').strip()
    print "h: " + h

    # crack it
    t = l.get_all([h])
    t = str(t[h])

    # return it
    print "Sending answer: " + t
    tn.write(t + "\n")
Example #12
0
def createMod16GrayLookupTable():
	table = LookupTable()
	table.add('0000', Point(1,0))
	table.add('0001', Point(0.9239,0.3827))
	table.add('0011', Point(0.7071,0.7071))
	table.add('0010', Point(0.3827,0.9239))
	table.add('0110', Point(0,1))
	table.add('0111', Point(-0.3827,0.9239))
	table.add('0101', Point(-0.7071,0.7071))
	table.add('0100', Point(-0.9239,0.3827))
	table.add('1100', Point(-1,0))
	table.add('1101', Point(-0.9239,-0.3827))
	table.add('1111', Point(-0.7071,-0.7071))
	table.add('1110', Point(-0.3827,-0.9239))
	table.add('1010', Point(0,-1))
	table.add('1011', Point(0.3827,-0.9239))
	table.add('1001', Point(0.7071,-0.7071))
	table.add('1000', Point(0.9239,-0.3827))
	return table