Author | Message |
---|
Rox n00b Posts: 11
| I wont to write my DC client but i have a problem with Lock to Key i'm using funtion from
Code: | http://dcplusplus.sourceforge.net/wiki/index.php/LockToKey#Cx23. | But i have manny errors :? Anybody have other function ? Sorry for my english :wink:
|
Meka][Meka Unstopable Posts: 700
| post what u have so far
|
Rox n00b Posts: 11
| I have these errors :
Quote: | C:\Documents and Settings\Rox\Moje dokumenty\Visual Studio Projects\WindowsApplication9\Form1.cs(58): The type or namespace name 'Strings' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Rox\Moje dokumenty\Visual Studio Projects\WindowsApplication9\Form1.cs(61): The type or namespace name 'Strings' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Rox\Moje dokumenty\Visual Studio Projects\WindowsApplication9\Form1.cs(65): The type or namespace name 'Strings' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Rox\Moje dokumenty\Visual Studio Projects\WindowsApplication9\Form1.cs(71): The type or namespace name 'Strings' could not be found (are you missing a using directive or an assembly reference?) | And Visual Studio mark this : ' key[i] = Strings.Chr([u:6665d0ba85]Strings.[/u:6665d0ba85]Asc(aLock[i]) ^ Strings.Asc(aLock[i - 1]));
|
Meka][Meka Unstopable Posts: 700
| try change strings to string
|
Rox n00b Posts: 11
| I trying but thats not works :( But i find other LocktoKey function on web and thats works Thx for help
|
Rox n00b Posts: 11
| Shit these function(http://lists.ximian.com/archives/public/mono-devel-list/2004-July/006885.html) generate very short Key:
Code: | [13:48] <unknown> (127.0.0.1) > $Key ’†2À€| | Anybody has other Lock To Key function ?
|
Rox n00b Posts: 11
| I use this funtion :
Code: | public class DCUtils { private static int Xor(params char[] values) { int h = (int)values[0]; for (int j = 1; j < values.Length; j++) h ^= (int)values[j]; return h; } private static string AssemblePart(int h) { h = ((h / 16) ^ (h * 16)) & 255; switch (h) { case 0: case 5: case 36: case 96: case 124: case 126: return String.Format("/%DCN{0:000}%/", h); default: System.Text.StringBuilder sb = new System.Text.StringBuilder(1); sb.Append((char)h); return sb.ToString(); } } public static string LockToKey(string Lck) { Lck = Lck.Split(' ')[0]; string result = AssemblePart(Xor(Lck[0], Lck[Lck.Length-1], Lck[Lck.Length-2], (char)5)); for(int j = 1; j < Lck.Length; j++) result = result + AssemblePart(Xor(Lck[j], Lck[j - 1])); return result; } } |
|
Meka][Meka Unstopable Posts: 700
| here is one ive found, the magic number is 5 to be passed
Code: | public static string LockToKey(string mLock,byte magic) { if (mLock.Length < 3)//too short return ""; int pos = mLock.IndexOf(" "); if (pos > 0)//del Pk part mLock = mLock.Substring(0,pos); string k = System.String.Empty; byte t; for (int i=0;i < mLock.Length;i++) { if (i == 0) //t = (byte)(mLock[0] ^ magic); t = (byte)(mLock[0] ^ mLock[mLock.Length -1] ^ mLock[mLock.Length -2] ^ magic); else t = (byte)(mLock[i] ^ mLock[i-1]); t = (byte)((t >> 4) ^ (t << 4)); k = k + EscapedSequence(t); } //t = (byte)(k[0] ^ k[k.Length - 1]); //k = EscapedSequence(t) + k.Substring(1,k.Length - 1); return k; } private static string EscapedSequence(byte x) { switch (x) { case 0: return "/%DCN000%/"; case 5: return "/%DCN005%/"; case 36: return "/%DCN036%/"; case 96: return "/%DCN096%/"; case 124: return "/%DCN124%/"; case 126: return "/%DCN126%/"; default: byte[] t = new byte[1]{x}; return System.Text.Encoding.Default.GetString(t); } } |
|