// Create a region hash made of the hashes of all the SOGs in the region public static BHash CreateRegionHash(Scene pScene) { BHasher regionHasher = new BHasherSHA256(); regionHasher.Add(pScene.RegionInfo.RegionID.GetBytes(), 0, 16); foreach (SceneObjectGroup sog in pScene.GetSceneObjectGroups().OrderBy(x => x.UUID)) { regionHasher.Add(LodenRegion.CreateSOGHash(sog)); } return(regionHasher.Finish()); }
// Create a uniquifying hash for this SOG instance. // The hash includes the UUID, a hash of the prim paramters, and the position in the scene. public static BHash CreateSOGHash(SceneObjectGroup pSog) { BHasher sogHasher = new BHasherSHA256(); sogHasher.Add(pSog.UUID.GetBytes(), 0, 16); foreach (SceneObjectPart sop in pSog.Parts.OrderBy(x => x.UUID)) { sogHasher.Add(sop.UUID.GetBytes(), 0, 16); sogHasher.Add(sop.Shape.GetMeshKey(sop.Scale, (float)OMVR.DetailLevel.Highest)); LodenRegion.AddPositionToHash(sogHasher, sop.AbsolutePosition, sop.RotationOffset); } ; return(sogHasher.Finish()); }
public string BHasherSHA256Test(string toHash) { BHasher hasher = new BHasherSHA256(); byte[] byt = Encoding.ASCII.GetBytes(toHash); hasher.Add(byt, 0, byt.Length); BHash hash = hasher.Finish(); System.Console.WriteLine("BHasherSHA256 hash output = " + hash.ToString()); return(hash.ToString()); }