val s1 = "1c0111001f010100061a024b53535009181c";
val s2 = "686974207468652062756c6c277320657965";
val base64p1 = Base64.getEncoder().encodeToString(new BigInteger(s1, 16).toByteArray())
val base64p2 = Base64.getEncoder().encodeToString(new BigInteger(s2, 16).toByteArray())
val zs : IndexedSeq[(Char, Char)] = base64p1.zip(base64p2);
val xor = zs.foldLeft(List[Char]())((a: List[Char] , b: (Char, Char)) => ((Char)((b._1^b._2))) :: a)
エラーが発生します。
Char.type does not take parameters
[error] val xor = zs.foldLeft(List[Char]())((a: List[Char] , b: (Char, Char)) => ((Char)((b._1^b._2))) :: a)
対応する文字列char値をXORし、リストに追加する方法は?
なぜbase64に行くのですか? (BigInt(s1、16)^ BigInt(s2、16))。toString(16).toList'を使用するのはいいですか?あなたの例では、どのようなリストや文字列をxoringの結果にする必要がありますか? – Kolmar
'foldLeft'の代わりに' map'を使うことができます。 – talex
@Kolmar六角復号1c0111001f010100061a024b53535009181cと686974207468652062756c6c277320657965とXOR演算を生成すべきである746865206b696420646f6e277420706c6179参照:https://cryptopals.com/sets/1/challenges/2 –