this.output = "Invalid flag, must starts with `flag{` and ends with `}`";
return null;
}
substring = obj.substring(5, obj.length - 1);
if ((0 != (substring.length % 3) ? 1 : 0) != 0) {
this.output = "Invalid key length (must be multiple of 3)";
return null;
}
i = 0;
getPrime = this.getPrime(215);
getPrime2 = this.getPrime(128);
getPrime3 = this.getPrime(170);
r36 = [Object];
obj2 = getiterator("Lattice-based cryptography is the generic term for constructions of cryptographic primitives that involve lattices, either in the construction itself or in the security proof.".substring(0, 50));
obj3 = obj2.next;
i2 = 0;
while (true) {
callthisN = obj3();
throw.ifnotobject(callthisN);
if (istrue(callthisN.done) != null) {
break;
}
r362 = callthisN.value;
try {
bytesToLong = this.bytesToLong(substring[i] + substring[i + 1] + substring[i + 2]); i += 3; r362 = (i >= substring.length ? 1 : 0); if (r362 != 0) { i = 0; } r36.push((this.getRandomBits(190) * getPrime) + ((this.modPow(getPrime2, bytesToLong, getPrime3) * BigInt(r362.charCodeAt(0))) % getPrime3)); } catch (ExceptionI0 unused) { z = r362; if (istrue(i2) == null) {
对于flag的每一块mi和密钥流的每个字节ki,我们生成了密文c
c = (qi × p0) + (Gm (mod P) ⋅ ki) (mod P)
其中ki为“Lattice-based
cryptography is the generic term for constructions of cryptographic
primitives that involve lattices, either in the construction itself or
in the security proof.”的前50字节的第一个字符的ASCII码值 qi为一个随机的190位整数
P为170位的质数 G是128位的质数 p0是215位的质数 xi为flag分解为长度为3的若干字符串
text = "Lattice-based cryptography is the generic term for constructions of cryptographic primitives that involve lattices, either in the construction itself or in the security proof." flag = b"" for i in trange(len(ct)): b = ct[i] % p y = b * inverse(ord(text[i]), P) % P x = discrete_log(R(y), R(G)) flag += long_to_bytes(x)