Example #1
0
def findminactivesbox(config):
    """
    Example which finds the minimum number of active S-boxes for AES like
    ciphers, with the parameters given in the config file.
    """
    if config["name"] == "aeslike":
        model = aeslike.buildmodel(config)
        solved_model = solvemodel(model)
        aeslike.printmodel(solved_model, config)
    elif config["name"] == "haraka":
        model = haraka.buildmodel(config)
        solved_model = solvemodel(model)
        haraka.printmodel(solved_model, config)
    return
Example #2
0
def findminactiveincreasing():
    """
    Example for finding minimum active S-box for increasing number of
    rounds.
    """
    config = {"rounds": 1,
              "wordsize": 8,
              "branchnumber": 5,
              "statedimension": 4}

    print("Rounds", "S-boxes", sep="\t")
    for num_rounds in range(1, 11):
        config["rounds"] = num_rounds
        solved_model = solvemodel(aeslike.buildmodel(config))
        print(num_rounds, round(solved_model.ObjVal), sep="\t")
    return