MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / function

Function function

other/sdes.py:42–53  ·  view source on GitHub ↗
(expansion, s0, s1, key, message)

Source from the content-addressed store, hash-verified

40
41
42def function(expansion, s0, s1, key, message):
43 left = message[:4]
44 right = message[4:]
45 temp = apply_table(right, expansion)
46 temp = xor(temp, key)
47 left_bin_str = apply_sbox(s0, temp[:4])
48 right_bin_str = apply_sbox(s1, temp[4:])
49 left_bin_str = "0" * (2 - len(left_bin_str)) + left_bin_str
50 right_bin_str = "0" * (2 - len(right_bin_str)) + right_bin_str
51 temp = apply_table(left_bin_str + right_bin_str, p4_table)
52 temp = xor(left, temp)
53 return temp + right
54
55
56if __name__ == "__main__":

Callers 9

test_zeroFunction · 0.85
test_positive_integersFunction · 0.85
test_large_numberFunction · 0.85
test_negative_numberFunction · 0.85
test_float_numberFunction · 0.85
intersectionFunction · 0.85
bisectionFunction · 0.85
simpson_integrationFunction · 0.85
sdes.pyFile · 0.85

Calls 3

apply_tableFunction · 0.85
xorFunction · 0.85
apply_sboxFunction · 0.85

Tested by 5

test_zeroFunction · 0.68
test_positive_integersFunction · 0.68
test_large_numberFunction · 0.68
test_negative_numberFunction · 0.68
test_float_numberFunction · 0.68