Created
December 9, 2019 16:28
-
-
Save flytzen/a381592b565b163bbd1355fc7e970b42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MACPlay | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int id = 200; | |
DateTime expiry = DateTime.UtcNow.AddMinutes(15); | |
var idbytes = BitConverter.GetBytes(id); | |
var datebytes = BitConverter.GetBytes(expiry.Ticks); | |
byte[] allstuff = new byte[12]; | |
System.Array.Copy(idbytes, allstuff,4); | |
System.Array.Copy(datebytes, 0, allstuff, 4, 8); | |
// protect here!! | |
//unprotect | |
var newid = BitConverter.ToInt32(idbytes); | |
var dateticks = BitConverter.ToInt64(datebytes); | |
var newexpiry = new DateTime(dateticks, DateTimeKind.Utc); | |
Console.WriteLine("Hello World!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment