Error pulling data from firebase database

Hello, I am sending the values ​​in binary number system from 256 bit length to firebase database from raspberry pi device. When I pull these values ​​from the Firebase application to the android application I made in MIT inventor, the first bits are drawn correctly, but after a certain point, the wrong bit values ​​are drawn. The data in the phiabase is '10100110010010111011100100010100001111100110101110011011100011110110000111110110101010010010010111100100011000101001001001101101011111001000000110111001011101110000101111001001011101000000000101011011000001010010011111000001010001000111101101010100100101111001000110001010010011011010111100001011110010010111010000000001010110110000010100100111110000010100010001111000100100100100100110110101111100100000110111001011101000000001010110110000010100100111110000010100010001111000, this is pulling the data inaccurately while the application is '1010011001001011000879642254......................55034880'. I'm waiting for your help.

Could you post the Raspberry Pi code that loads Firebase?

A screen shot of the Firebase web view of its content would also help.

My Raspberry Pi code;

config = {
"apiKey": "..................",
"authDomain": "jrng0606",
"databaseURL": "https://jrng0606-default-rtdb.firebaseio.com/",
"storageBucket": "project-35371049712"
}

firebase = pyrebase.initialize_app(config)
database = firebase.database()
x2 = 489
y2 = 100
x_hashed_string = hashlib.sha256(str(x2).encode('utf-8')).hexdigest()
y_hashed_string = hashlib.sha256(str(y2).encode('utf-8')).hexdigest()
x_int_val = int(x_hashed_string, base=16)
y_int_val = int(y_hashed_string, base=16)
nor_int_val = (x_int_val) ^ (y_int_val)
nor_hex_val = hex(nor_int_val)
nor_bin_val = bin(nor_int_val)[2:].zfill(8)
key_len = len(nor_bin_val)
if key_len == 256:
print('Anahtar: ', nor_bin_val)
print('Anahtar uzunluğu: ', key_len)
print('')
database.child("Anahtar").set(nor_bin_val)


This is wonderful!

You have uncovered the limits of Firebase Realtime Database's decimal number precision!

I see in the web display of the 'Anahlar' value that it lacks quotes ("") around it, and there no prefix like 'B' to hint that it might contain binary values at the bit level (as opposed to being a decimal number that happens to start with decimal digits 1110010...).

So I am guessing this really big decimal number might be losing precision along the way into AI2, converting into a long floating point number.

I have not seen any Firebase blocks in Ai2 that can handle a blob, which I think is the proper data type for this.

You might try to settle for a fluffier representation, adding a 'B' in front of the digits, to turn the Firebase value into a 257 byte long text of '0's and '1's, and remove the 'B' in AI2 before using the math blocks that convert text binary to decimal numbers.

Alternatively, experiment with what Firebase will save if you upload from AI2 a list of unsigned byte values (0-255). Examine the uploaded data in the Firebase Web interface, and see if you can replicate it from your Raspberry Pi. That would increase your compression level by a factor of 8.

Just put your "number" onto Firebase as a "string" and handle it back to a "number" when required.