diff --git a/README.md b/README.md index 1b0fd16..88802ec 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,5 @@ I made it because I want to try to break it. This will work iff I succeed in building a PPT-discriminator for sha256 from randomness As my first approach this discriminator will be based on an LSTM-network. Update: This worked out way better than expected; given long enought sequences (128 Bytes are more than enough) we can discriminate successfully in 100% of cases. -Update: I did an upsie in the training-code and the discriminator is actually shit. +Update 2: I did an upsie in the training-code and the discriminator is actually shit. +Update 3: Turns out: sha256 produces fairly high quality randomness and this project seems to have failed... diff --git a/discriminate.py b/discriminate.py index c8fadf8..2bdff23 100644 --- a/discriminate.py +++ b/discriminate.py @@ -10,7 +10,7 @@ import random import shark from model import Model -bs = int(256/8) +bs = shark.bs class Model(nn.Module): def __init__(self): diff --git a/model.py b/model.py index a42fec5..ee20b42 100644 --- a/model.py +++ b/model.py @@ -3,6 +3,8 @@ from torch import nn from torch import nn, optim from torch.utils.data import DataLoader +import shark + class Model(nn.Module): def __init__(self): super(Model, self).__init__() diff --git a/shark.py b/shark.py index 06e37fd..ef4f747 100644 --- a/shark.py +++ b/shark.py @@ -3,12 +3,6 @@ import math import os import random -# Shark is a sha256+xor based encryption. -# I made it because I want to try to break it. -# (Precisely: Show it does not provide semantic security, because it is not IND-CPA-secure) -# This will work iff I succeed in building a PPT-discriminator for sha256 from randomness -# As my first approach this discriminator will be based on an LSTM-network. - bs = int(256/8) def xor(ta,tb):