Ejemplo n.º 1
0
        public void TestVerifyPoke()
        {
            var vector =
                "A96E2D8D9B99DBFB934939C097E3AC101C7D48CEC52FCA717B14B19890208592045C430035DD09A31446142E9EA33CF3E6B6E69484B6D2EED500B8389048013491602403DBE7B814EA069667CFADAFE74895217D78037B4A456FAB2CAFD71E69504F4B4509000000000000"
                .ToByteArray();
            var vector2 =
                "A96E2D8D9B99DBFB934939C097E3AC101C7D48CEC52FCA717B14B19890208592045C430035DD09A31446142E9EA33CF3E6B6E69484B6D2EED500B8389048013491602403DBE7B814EA069667CFADAFE74895217D78037B4A456FAB2CAFD71E690000504F4B4509000000000000"
                .ToByteArray();

            Assert.True(MemeCrypto.VerifyMemePOKE(vector, out _));
            Assert.True(MemeCrypto.VerifyMemePOKE(vector2, out _));
        }
Ejemplo n.º 2
0
        public static RentalTeam DecryptQRCode(Image QR)
        {
            //Read the bytes of the QR code
            byte[] data = ParseQR(QR);

            //All data is shifted to the left by 4. Shift the data to the correct location.
            data = ShiftArray(data);

            //ZXing has added the header bytes to the raw bytes. These are the first 3, so skip them.
            var qrue = data.Skip(3).ToArray();

            //MEME CRYPTO!!! De-Meme the data
            if (!MemeCrypto.VerifyMemePOKE(qrue, out var qrt))
            {
                Console.WriteLine("it failed");
                return(null);
            }

            //unencrypt the data in the plaintext.
            byte[] qrDec = QR_t(qrt);

            //build the rental team.
            return(new RentalTeam(qrDec));
        }