GetMd5ByteArray() public static method

public static GetMd5ByteArray ( byte data ) : byte[]
data byte
return byte[]
コード例 #1
0
        protected override void loadFlashlight()
        {
            if (s_Flashlight == null)
            {
                return;
            }

            newFlashlightOverlay = true;
            byte[] bytes = osu_gameplay.ResourcesStore.ResourceManager.GetObject("flashlightv2_mania") as byte[];

            if (bytes == null)
            {
                newFlashlightOverlay = false;
                bytes = ResourcesStore.ResourceManager.GetObject("flashlight2") as byte[];
                //use old flashlight for now
            }

            byte[] hash = CryptoHelper.GetMd5ByteArray(bytes);

            byte[] expected = newFlashlightOverlay ?
                              new byte[] { 238, 208, 143, 44, 243, 39, 228, 31, 59, 30, 20, 241, 91, 126, 248, 201 } :
            new byte[] { 170, 142, 53, 203, 205, 131, 29, 55, 53, 91, 207, 196, 60, 73, 12, 190 };

            bool notmatching = false;

            for (int i = 0; i < 16; i++)
            {
                if (hash[i] != expected[i])
                {
                    notmatching = true;
                    break;
                }
            }

            if (notmatching)
            {
                GameBase.Scheduler.Add(delegate
                {
                    Player.flag |= BadFlags.FlashlightChecksumIncorrect;
                    Player.wasAllowingSubmission = false;
                }, true);
            }

            s_Flashlight.Texture = pTexture.FromBytes(bytes);
        }