I am working with BigInteger, and using my function I write a BigInteger of 256 bits to a file (there are 64 such numbers)
public static byte[] toHH2(BigInteger n) {
byte[] b = new byte[256];
for(int i = 0; i < 256; i+=8) {
b[i] = (byte) (n.longValue() >> (248 - i) & 0xff);
}
return b;
}
Then I need to read this 256 bit number and write it to a variable. But for some reason, I end up with a maximum of 64 bit numbers, and I need 256, how to fix the error?
var dataSignatureInt = bytesToIntArray(Files.readAllBytes(Path.of("C:\\Users\\User\\IdeaProjects\\CryptoLab1\\src\\crypto\\DigitalSignatureGOST.png")));
for(int i = 0; i < file.length; i+=256) { //file lenght = 16384
BigInteger value = BigInteger.valueOf(dataSignatureInt[i]);
for(int j = 0; j < 256; j++) {
System.out.println("i = " + i + " j = " + j);
value = BigInteger.valueOf((value.longValue() << 8) | dataSignatureInt[i + j]);
}