Skip to content

Commit

Permalink
Crypto: lab3 changes in diff_anal
Browse files Browse the repository at this point in the history
  • Loading branch information
tutkarma committed Apr 1, 2019
1 parent 411e490 commit 937c314
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Crypto/lab3/diff_anal.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def bitcount(n):


def mean(list_):
return [int(sum(i))/len(i) for i in zip(*list_)]
return [int(sum(i)/len(i)) for i in zip(*list_)]


if __name__ == '__main__':
Expand All @@ -49,7 +49,7 @@ def mean(list_):
diffs = []
rounds = range(0, 81, 5)
for i in rounds:
logging.info("Count rounds: ".format(i))
logging.info("Count rounds: {0}".format(i))
output1 = sha1.sha1(input1, i)
output2 = sha1.sha1(input2, i)
logging.info("Output original: {0}".format(output1))
Expand All @@ -61,6 +61,11 @@ def mean(list_):
all_diffs.append(diffs)

mean_diffs = mean(all_diffs)
for i, j in zip(cnt_rounds, mean_diffs):
print("Count rounds: {0}".format(i))
print("Count of different bits: {0}".format(j))
print("------------")

plt.bar(cnt_rounds, mean_diffs, align='center')
plt.xlabel('Count rounds')
plt.ylabel('Count of different bits')
Expand Down

0 comments on commit 937c314

Please sign in to comment.