diff --git a/OpenRA.FileFormats/FileFormats/BlowfishKeyProvider.cs b/OpenRA.FileFormats/FileFormats/BlowfishKeyProvider.cs index 301da73330..a71404a221 100644 --- a/OpenRA.FileFormats/FileFormats/BlowfishKeyProvider.cs +++ b/OpenRA.FileFormats/FileFormats/BlowfishKeyProvider.cs @@ -19,24 +19,6 @@ namespace OpenRA.FileFormats { const string pubkeyStr = "AihRvNoIbTn85FZRYNZRcT+i6KpU+maCsEqr3Q5q+LDB5tH7Tz2qQ38V"; - static sbyte[] char2num = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; - class PublicKey { public uint[] key1 = new uint[64]; @@ -128,25 +110,9 @@ namespace OpenRA.FileFormats void init_pubkey() { - int i = 0; - uint i2, tmp; - byte[] keytmp = new byte[256]; - init_bignum(pubkey.key2, 0x10001, 64); - i2 = 0; - while (i < pubkeyStr.Length) - { - tmp = (uint)char2num[pubkeyStr[i++]]; - tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]]; - tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]]; - tmp <<= 6; tmp |= (uint)(byte)char2num[pubkeyStr[i++]]; - keytmp[i2++] = (byte)((tmp >> 16) & 0xff); - keytmp[i2++] = (byte)((tmp >> 8) & 0xff); - keytmp[i2++] = (byte)(tmp & 0xff); - } - - key_to_bignum(pubkey.key1, keytmp, 64); + key_to_bignum(pubkey.key1, Convert.FromBase64String(pubkeyStr), 64); pubkey.len = bitlen_bignum(pubkey.key1, 64) - 1; }