diff --git a/bvCrawler4/App.config b/bvCrawler4/App.config index fa0e5019..aa0fb07e 100644 --- a/bvCrawler4/App.config +++ b/bvCrawler4/App.config @@ -6,6 +6,6 @@ providerName="MySql.Data.MySqlClient" /> - + diff --git a/gts/gts.csproj b/gts/gts.csproj index f1a8be58..0b0cf257 100644 --- a/gts/gts.csproj +++ b/gts/gts.csproj @@ -59,6 +59,7 @@ + @@ -95,6 +96,13 @@ BoxUp.aspx + + PadMath.aspx + ASPXCodeBehind + + + PadMath.aspx + Decode.aspx ASPXCodeBehind diff --git a/gts/test/PadMath.aspx b/gts/test/PadMath.aspx new file mode 100644 index 00000000..bec07a6f --- /dev/null +++ b/gts/test/PadMath.aspx @@ -0,0 +1,10 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeBehind="PadMath.aspx.cs" Inherits="PkmnFoundations.GTS.test.PadMath" %> + + + + + +
+ +
+
diff --git a/gts/test/PadMath.aspx.cs b/gts/test/PadMath.aspx.cs new file mode 100644 index 00000000..9063aec5 --- /dev/null +++ b/gts/test/PadMath.aspx.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Text; +using System.IO; + +namespace PkmnFoundations.GTS.test +{ + public partial class PadMath : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + FileStream s = File.Open(Server.MapPath("~/Box Upload Xor Pad.bin"), FileMode.Open); + byte[] pad = new byte[s.Length]; + s.Read(pad, 0, pad.Length); + s.Close(); + + byte[] result = new byte[256]; + + // difference between items + for (int x = 0; x < pad.Length; x++) + { + byte bx = (byte)x; + byte prevOffs = (byte)(bx - 4); + byte value = (byte)(((pad[bx] ^ pad[prevOffs]) & 0x80) > 0 ? 0xff : 0x00); + result[x] = value; + } + + litRandom.Text = RenderHex(result.ToHexStringLower()); + } + + + private String RenderHex(String hex) + { + StringBuilder builder = new StringBuilder(); + for (int x = 0; x < hex.Length; x += 16) + { + if (x % 32 == 0) + { + builder.Append((x >> 1).ToString("x4")); + builder.Append(": "); + } + + builder.Append(hex.Substring(x, Math.Min(16, hex.Length - x))); + builder.Append((x % 32 == 0) ? " " : "
"); + } + return builder.ToString(); + } + + protected static int Rng1(int prev) + { + return (prev * 0x45 + 0x1111) & 0x7fffffff; + } + + protected static int Rng2(int prev) + { + return (int)((0x41C64E6Du * (uint)prev) + 0x6073u); + } + + protected static int Rng3(int prev) + { + return (int)((0x6C078965u * (uint)prev) + 0x1); + } + + + } +} \ No newline at end of file diff --git a/gts/test/PadMath.aspx.designer.cs b/gts/test/PadMath.aspx.designer.cs new file mode 100644 index 00000000..6aa429ab --- /dev/null +++ b/gts/test/PadMath.aspx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace PkmnFoundations.GTS.test { + + + public partial class PadMath { + + /// + /// litRandom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litRandom; + } +}