This commit is contained in:
Reynir Björnsson 2018-09-07 12:02:01 +02:00
parent c3515a6fab
commit 3deea9a0e1
3 changed files with 2 additions and 5 deletions

View File

@ -17,8 +17,6 @@
*) *)
let chr x = char_of_int x
let and32 x n = Int32.logand x n let and32 x n = Int32.logand x n
let xor32 x y = Int32.logxor x y let xor32 x y = Int32.logxor x y
let or32 x y = Int32.logor x y let or32 x y = Int32.logor x y

View File

@ -1,6 +1,4 @@
val chr : int -> char
val and32 : Int32.t -> Int32.t -> Int32.t val and32 : Int32.t -> Int32.t -> Int32.t
val xor32 : Int32.t -> Int32.t -> Int32.t val xor32 : Int32.t -> Int32.t -> Int32.t
val or32 : Int32.t -> Int32.t -> Int32.t val or32 : Int32.t -> Int32.t -> Int32.t

View File

@ -31,7 +31,8 @@ let xor_strings b c =
let int c = int_of_char c in let int c = int_of_char c in
String.init (String.length b) String.init (String.length b)
(fun i -> (fun i ->
Bin.chr((int b.[i]) lxor (int c.[i]))) char_of_int @@
int b.[i] lxor int c.[i])
let encrypt cbc enc p = let encrypt cbc enc p =