Beispiel #1
0
def generateSelectionFunction(key, pt_list, ct_list=None):
    """
    平文もしくは暗号文のリストから、選択関数を生成する関数。
    基本的には、この関数のみをインタフェースとして用いるのが望ましい.
    """
    if ct_list is None:
        aes_obj = myAES.AES()
        aes_obj.keyExpansion(key)
        ct_list = []
        for pt in pt_list:
            ct_list += [aes_obj.encrypt(pt)]

    dpa_obj = AESDPA()
    result = []
    for ct in ct_list:
        result += [ dpa_obj.getByteSelectionFunction(ct) ]
    return result
Beispiel #2
0
def AES_CTR_encrypt(key, ptList, iv):
    return CTR_encrypt(myAES.AES(), key, ptList, iv)
Beispiel #3
0
def AES_CBC_decrypt(key, ctList, iv):
    return CBC_decrypt(myAES.AES(), key, ctList, iv)
Beispiel #4
0
def AES_ECB_decrypt(key, ctList):
    return ECB_decrypt(myAES.AES(), key, ctList)
Beispiel #5
0
def AES_ECB_encrypt(key, ptList):
    return ECB_encrypt(myAES.AES(), key, ptList)