OneDrive for Business quickXorHash

时间:2016-07-01 09:58:22

标签: office365 onedrive

如何在本地计算OneDrive quickXorHash,以便验证我上传的文件?是否有某种关于如何计算它的规范?

2 个答案:

答案 0 :(得分:0)

据我所知,目前没有关于quickXorHash的文档,但微软正在构建文档(参考here

答案 1 :(得分:0)

现在解释该算法here

method block zero():
     returns a block with all zero bits.

   method block reverse(block b)
     returns a block with all of the bytes reversed (00010203... => ...03020100)

   method block extend8(byte b):
     returns a block with all zero bits except for the lower 8 bits which come from b.

   method block extend64(int64 i):
     returns a block of all zero bits except for the lower 64 bits which come from i
     and are in little-endian byte order.

   method block rotate(block bl, int n):
     returns bl rotated left by n bits.

   method block xor(block bl1, block bl2):
     returns a bitwise xor of bl1 with bl2

   method block XorHash0(byte[] rgb):
     block ret = zero()
     for (int i = 0; i < rgb.Length; i ++)
       ret = xor(ret, rotate(extend8(rgb[i]), i * 11))
     returns reverse(ret)

   entrypoint block XorHash(byte[] rgb):
     returns xor(extend64(rgb.Length), XorHash0(rgb))