예제 #1
0
 def test_PrepSteg(self):
     msg1 = np.array([16, 52, 50, 11, 6, 13, 41, 26, 39, 15, 39, 11])
     msg2 = np.array([20, 36, 39, 11, 59, 23, 28, 16, 53, 8, 57, 0])
     expectedresult1 = np.array(
         [47, 44, 14, 33, 4, 58, 19, 6, 16, 52, 50, 11, 6, 13, 41, 26, 39, 15, 39, 11])
     expectedresult2 = np.array(
         [22, 29, 9, 53, 17, 23, 57, 14, 20, 36, 39, 11, 59, 23, 28, 16, 53, 8, 57, 0])
     result1 = jt.prepsteg(msg1)
     result2 = jt.prepsteg(msg2)
     self.assertEqual(len(result1), len(expectedresult1))
     self.assertEqual(len(result2), len(expectedresult2))
     self.assertEqual(result1.tolist(), expectedresult1.tolist())
     self.assertEqual(result2.tolist(), expectedresult2.tolist())
예제 #2
0
def createciphermsgs_packer_other(totalpackets, ciphermsgs, cipherlist, verbose=False):
# Packs hidden message into JT65 symbols with all the other available ciphers

    for index in range(totalpackets):
        status = 0
        if index == 0:
            # First packet sets first bit to one, then remaining bits show
            # total number of packets
            status = 0x80 | totalpackets
        else:
            # All remaining packets send packet number, zero indexed
            status = index

        thissteg = bytes8tojt65(cipherlist[index * 8:(index * 8) + 8], status)
        secretjtfec = jt.prepsteg(thissteg)

        if verbose:
            print "Status: " + str(status)
            print "JT65 Encoded Cipher Data Msg " + str(index) + " : " + str(thissteg)
            print "JT65 Encoded Cipher Data Msg with FEC " + str(index) + " : " + str(secretjtfec)

        ciphermsgs.append(secretjtfec)
예제 #3
0
def createciphermsgs_none(jt65msgcount, stegmsg, verbose=False):
# Packs hidden message into JT65 symbols with no cipher

    ciphermsgs = []

    # Can we fit your hidden message?
    if jt65msgcount * 13 < len(stegmsg):
        print(
            "Length of hidden message exceeds capacity of number of valid JT65 messages provided")
        sys.exit(0)

    for index in range(jt65msgcount):
        secretjt = jt.encode(stegmsg[index * 13:index * 13 + 13])
        secretjtfec = jt.prepsteg(secretjt)

        if verbose:
            print "Secret message " + str(index) + " : " + stegmsg[index * 13:index * 13 + 13]
            print "Secret message " + str(index) + " encoded : " + str(secretjt)
            print "Secret message " + str(index) + " encoded with FEC : " + str(secretjtfec)

        ciphermsgs.append(secretjtfec)

    return ciphermsgs
예제 #4
0
def createciphermsgs_packer_xor(totalpackets, originallength, ciphermsgs, cipherlist, verbose=False):
# Packs hidden message into JT65 symbols with XOR cipher

    for index in range(totalpackets):
        # Determine how many bytes are in this message
        if originallength >= 8:
            thislength = 8
        else:
            thislength = originallength % 8
        originallength -= 8

        status = 0
        if index == 0:
            # First packet sets first bit to one, then remaining bits show
            # total number of packets
            status = 0x80 | totalpackets
        elif index == totalpackets - 1:
            # Last packet sets second bit to one, then remaining bites show how
            # many bytes to read out of this packet
            status = status | 0x40 | thislength
        else:
            # All remaining packets send packet number, zero indexed
            status = index
        if index == 0 and index == totalpackets - 1:
            # Handle the case where the total size is only one packet long
            status = 0x80 | 0x40 | thislength

        thissteg = bytes8tojt65(cipherlist[index * 8:(index * 8) + 8], status)
        secretjtfec = jt.prepsteg(thissteg)

        if verbose:
            print "Status: " + str(status) + " thislength : " + str(thislength)
            print "JT65 Encoded Cipher Data Msg " + str(index) + " : " + str(thissteg)
            print "JT65 Encoded Cipher Data Msg with FEC " + str(index) + " : " + str(secretjtfec)

        ciphermsgs.append(secretjtfec)