From 6208f1f502b5c4a3e2f5b6e1771b5f7ce5dd9fbe Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Mon, 11 Sep 2017 09:46:26 +0200 Subject: [PATCH] Projekt neu eingecheckt --- src/ScharedSecret.java | 135 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 src/ScharedSecret.java diff --git a/src/ScharedSecret.java b/src/ScharedSecret.java new file mode 100644 index 0000000..f38cbe3 --- /dev/null +++ b/src/ScharedSecret.java @@ -0,0 +1,135 @@ +import java.sql.Time; +import java.util.Random; + +public class ScharedSecret { + static Random rand=new Random(); + + public static int r10(){ + return rand.nextInt(10); + } + + public static int[] encodeBit(boolean bit){ + int threshold=22; + int dist=3; + + int low = threshold-dist; + int high = threshold+dist; + + int d1,d2,d3,d4,d5; + //System.out.println("\nbit: "+(bit?1:0)); + if (bit){ + //System.out.println("bounds: ["+threshold+"..."+high+"]"); + d1=r10(); + while(d1+18(240+22)?1:0); + } + } + } +} -- 2.30.2