So I've passed coursera Scala course and deciced to apply my fresh knowledge.
Here is my algo:
Xor ciphers with each other and collect xor result for each position.
As a result I got a Map[Int, List[String]] where Int is a position of char in chiper and List[String] are all xor results for current position.
I have an assumption that if xor in List[String] equals to UPPER ASCII alpha, it means that source of this computation was: *space xor lower_alpha = UPPER_alpha*.
I can try to guess key value: c1 (char from 1st cipher), c2(char from 2nd cipher), xorRes (c1 xor c2 = xorRes) => c2 xor(c1 xor xorRes) or c1 xor(c2 xor xorRes) = *lower_alpha*.
Here is a part of code:
/**
* hex1 is a hex from 1st cipher
* hex2 is a hex from second cipher
* xor is ahex1 xor hex2
* @return List with pos of possible key and possible key value else return empty list
* */
def getPossibleKey(hex1: String, hex2: String, xor: String, pos: Int): List[(Int, String)] = {
if(isUpperAphpa(xor)){
if( isLowerAphpa(xorHexStrings(xorWithSpace(hex1), hex2)) ){
List( (pos, xorWithSpace(hex1)) )
}else if( isLowerAphpa(xorHexStrings(xorWithSpace(hex2), hex1)) ){
List( (pos, xorWithSpace(hex2)) )
}else{
List.empty
}
}else{
List.empty
}
}
As a result i got: List[Int, String] where String is the most popular lower_alpha got from getPossibleKey function.
Then i just applied collected key to each cipher and started to fix the key. I know that c1 xor m1 = k1 where c1 is a cipher fragment, k1 is a key fragment and m1 is a plain text.