range_sha1

ppaajjaa

Senior Member
Apr 24, 2006
68
14
0
OTA packages have update script inside in folder "\META-INF\com\google\android\updater-script".
There is "range_sha1" function used for calculation SHA1 hash.
Code:
range_sha1("/dev/block/bootdevice/by-name/system", "2,0,1") == "2e0b37350f70a4f3d241e933d03c507e14aa25db"
I'm trying to find definition (source) of the function to know how SHA1 is exactly calculated and what second argument means.
Do you have any idea where I could find it?
 

ppaajjaa

Senior Member
Apr 24, 2006
68
14
0
Ok, I've finally found it here.

"2, 0, 1" mean 2 numbers, 0 = min, 1 = max, it is parsed to one RangeSet(0, 1)
for the specified range is SHA1 calculated:
bytes: [0..1*BLOCKSIZE] where BLOCKSIZE = 4096

It means that the range_sha1("/dev/block/bootdevice/by-name/system", "2,0,1") calculates SHA1 hash of first 4096 bytes of "/dev/block/bootdevice/by-name/system".

;)
 
  • Like
Reactions: zeroepoch