C++ Expert to convert code into English!!!
Discussion
I can program a reasonable amount, but not in C++ which is incomprehensible double dutch to me.
I have a piece of C++ code for a maths function that was written in Visual Studio 19 that I need translating into plain English.
You basically feed the function 3 bytes and it squirts out 3 manipulated bytes.
I can easily write the code in my chosen processor language once I understand what the hell it is doing.
Can a C++ expert offer to have a look in exchange for kudos and/or beer tokens?
Please PM if you are the expert I need. Thanks
I have a piece of C++ code for a maths function that was written in Visual Studio 19 that I need translating into plain English.
You basically feed the function 3 bytes and it squirts out 3 manipulated bytes.
I can easily write the code in my chosen processor language once I understand what the hell it is doing.
Can a C++ expert offer to have a look in exchange for kudos and/or beer tokens?
Please PM if you are the expert I need. Thanks
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Calculation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int Func3(int paramInt1, int paramInt2, int paramInt3)
{
int i = paramInt1 << 8 | paramInt2;
int j;
int k; int m; int n; int i1; switch (paramInt3)
{
case 65:
case 66:
case 67:
case 68:
case 69:
case 70:
case 71:
case 72:
case 73:
case 74:
case 75:
case 76:
case 77:
case 78:
case 79:
case 80:
case 81:
case 82:
case 83:
case 84:
case 85:
case 86:
case 87:
case 88:
case 89:
case 90:
case 91:
case 92:
case 93:
case 94:
case 95:
case 96:
default:
return 0;
case 1:
j = 20483;
k = 37495;
m = 19380;
n = 2;
i1 = -1;
break;
case 2:
j = 48737;
k = 29064;
m = 0;
n = -2;
i1 = 1;
break;
case 3:
j = 38851;
k = 17007;
m = 57213;
n = 2;
i1 = -1;
break;
case 4:
j = 38191;
k = 42963;
m = 45416;
n = -3;
i1 = 1;
break;
case 5:
j = 31893;
k = 60216;
m = 0;
n = 1;
i1 = -2;
break;
case 6:
j = 26458;
k = 15181;
m = 11362;
n = -3;
i1 = 1;
break;
case 7:
j = 10773;
k = 36766;
m = 28592;
n = 2;
i1 = -1;
break;
case 8:
j = 13376;
k = 4967;
m = 62941;
n = 2;
i1 = -3;
break;
case 9:
j = 2197;
k = 24862;
m = 65475;
n = -2;
i1 = 3;
break;
case 10:
j = 31199;
k = 59852;
m = 0;
n = 1;
i1 = -3;
break;
case 11:
j = 45383;
k = 9690;
m = 0;
n = 3;
i1 = -2;
break;
case 12:
j = 34146;
k = 59163;
m = 0;
n = -1;
i1 = 2;
break;
case 13:
j = 62765;
k = 33340;
m = 5749;
n = 3;
i1 = -1;
break;
case 14:
j = 45458;
k = 44092;
m = 0;
n = -1;
i1 = 3;
break;
case 15:
j = 37357;
k = 39321;
m = 0;
n = -2;
i1 = 1;
break;
case 16:
j = 8713;
k = 454;
m = 23575;
n = 1;
i1 = -2;
break;
case 17:
j = 9988;
k = 56677;
m = 29637;
n = -3;
i1 = 1;
break;
case 18:
j = 57758;
k = 34088;
m = 11152;
n = 1;
i1 = -3;
break;
case 19:
j = 33800;
k = 14769;
m = 0;
n = -2;
i1 = 1;
break;
case 20:
j = 4069;
k = 4013;
m = 24616;
n = -1;
i1 = 2;
break;
case 21:
j = 17056;
k = 12969;
m = 11927;
n = 3;
i1 = -1;
break;
case 22:
j = 31370;
k = 60592;
m = 0;
n = -1;
i1 = 3;
break;
case 23:
j = 24184;
k = 58486;
m = 0;
n = -1;
i1 = 3;
break;
case 24:
j = 56838;
k = 5012;
m = 35563;
n = 2;
i1 = -3;
break;
case 25:
j = 49473;
k = 5452;
m = 33161;
n = 3;
i1 = -2;
break;
case 26:
j = 64459;
k = 44104;
m = 0;
n = 2;
i1 = -1;
break;
case 27:
j = 6123;
k = 30247;
m = 0;
n = -1;
i1 = 3;
break;
case 28:
j = 62885;
k = 57915;
m = 28211;
n = -2;
i1 = 3;
break;
case 29:
j = 56790;
k = 34537;
m = 0;
n = -3;
i1 = 1;
break;
case 30:
j = 34655;
k = 4726;
m = 0;
n = 3;
i1 = -1;
break;
case 31:
j = 45667;
k = 2227;
m = 0;
n = -3;
i1 = 1;
break;
case 32:
j = 64118;
k = 22124;
m = 0;
n = 1;
i1 = -3;
break;
case 33:
j = 20483;
k = 37495;
m = 19380;
n = 2;
i1 = -1;
break;
case 34:
j = 18934;
k = 33007;
m = 45671;
n = -1;
i1 = 2;
break;
case 35:
j = 53898;
k = 43937;
m = 8992;
n = 3;
i1 = -2;
break;
case 36:
j = 26472;
k = 30849;
m = 15462;
n = -2;
i1 = 3;
break;
case 37:
j = 18864;
k = 16973;
m = 0;
n = -2;
i1 = 2;
break;
case 38:
j = 10153;
k = 24758;
m = 0;
n = -2;
i1 = 2;
break;
case 39:
j = 28031;
k = 31768;
m = 65233;
n = 3;
i1 = -1;
break;
case 40:
j = 9577;
k = 32816;
m = 0;
n = -3;
i1 = 3;
break;
case 41:
j = 33294;
k = 41833;
m = 63823;
n = 2;
i1 = -2;
break;
case 42:
j = 46258;
k = 33763;
m = 47869;
n = 2;
i1 = -2;
break;
case 43:
j = 303;
k = 15452;
m = 49261;
n = -3;
i1 = 1;
break;
case 44:
j = 14480;
k = 52729;
m = 0;
n = 2;
i1 = -2;
break;
case 45:
j = 26181;
k = 30558;
m = 11669;
n = -1;
i1 = 1;
break;
case 46:
j = 57729;
k = 31412;
m = 0;
n = 3;
i1 = -3;
break;
case 47:
j = 38273;
k = 42785;
m = 57170;
n = 2;
i1 = -3;
break;
case 48:
j = 65304;
k = 24702;
m = 12077;
n = 2;
i1 = -1;
break;
case 49:
j = 25997;
k = 16247;
m = 11573;
n = -2;
i1 = 3;
break;
case 50:
j = 47122;
k = 17812;
m = 0;
n = 3;
i1 = -1;
break;
case 51:
j = 62790;
k = 184;
m = 43056;
n = -2;
i1 = 1;
break;
case 52:
j = 27811;
k = 36172;
m = 10312;
n = -1;
i1 = 2;
break;
case 53:
j = 33495;
k = 4706;
m = 23772;
n = 1;
i1 = -3;
break;
case 54:
j = 11806;
k = 6016;
m = 0;
n = 2;
i1 = -1;
break;
case 55:
j = 23022;
k = 61027;
m = 0;
n = 1;
i1 = -3;
break;
case 56:
j = 14502;
k = 52925;
m = 45502;
n = -3;
i1 = 2;
break;
case 57:
j = 19654;
k = 47349;
m = 29195;
n = 3;
i1 = -2;
break;
case 58:
j = 4043;
k = 49055;
m = 0;
n = 1;
i1 = -2;
break;
case 59:
j = 238;
k = 61025;
m = 46052;
n = -2;
i1 = 3;
break;
case 60:
j = 26525;
k = 16314;
m = 0;
n = 2;
i1 = -1;
break;
case 61:
j = 27577;
k = 18161;
m = 3841;
n = -3;
i1 = 1;
break;
case 62:
j = 11820;
k = 48834;
m = 24936;
n = -3;
i1 = 2;
break;
case 63:
j = 926;
k = 34536;
m = 62639;
n = -1;
i1 = 1;
break;
case 64:
j = 34242;
k = 21476;
m = 0;
n = 2;
i1 = -3;
break;
case 97:
j = 11937;
k = 0;
m = 54278;
n = 3;
i1 = -1;
break;
case 98:
j = 11129;
k = 0;
m = 41060;
n = 1;
i1 = -3;
break;
case 99:
j = 16232;
k = 0;
m = 37025;
n = 3;
i1 = -2;
break;
case 100:
j = 62287;
k = 21359;
m = 0;
n = -1;
i1 = 1;
break;
case 101:
j = 19345;
k = 63583;
m = 20313;
n = -2;
i1 = 2;
break;
case 102:
j = 50636;
k = 34432;
m = 58878;
n = -2;
i1 = 2;
break;
case 103:
j = 8636;
k = 42038;
m = 0;
n = 3;
i1 = -1;
break;
case 104:
j = 49296;
k = 0;
m = 23727;
n = -2;
i1 = 2;
break;
case 105:
j = 62603;
k = 0;
m = 7632;
n = 2;
i1 = -1;
break;
case 106:
j = 54947;
k = 13952;
m = 0;
n = -3;
i1 = 2;
break;
case 107:
j = 46336;
k = 0;
m = 32973;
n = -1;
i1 = 3;
break;
case 108:
j = 31276;
k = 0;
m = 41988;
n = -2;
i1 = 2;
break;
case 109:
j = 24959;
k = 31354;
m = 55064;
n = 1;
i1 = -1;
break;
case 110:
j = 39963;
k = 29660;
m = 0;
n = 2;
i1 = -3;
break;
case 111:
j = 16360;
k = 6010;
m = 0;
n = 1;
i1 = -2;
break;
case 112:
j = 50050;
k = 36355;
m = 34628;
n = 3;
i1 = -3;
break;
}
return Func2(i, j, k, m, n, i1);
}
int Func2(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
{
int i = paramInt1 + paramInt2 & 0xFFFF;
int j = Func1(paramInt5, i);
int k = paramInt1 + paramInt3 & 0xFFFF;
int m = Func1(paramInt6, k);
int n = j * m;
int i1 = n + paramInt4;
return i1 & 0xFFFF;
}
int Func1(int paramInt1, int paramInt2)
{
if (paramInt1 > 0)
{
return 0xFFFF & (paramInt2 << paramInt1 | paramInt2 >> 16 - paramInt1);
}
return 0xFFFF & (paramInt2 >> -paramInt1 | paramInt2 << 16 + paramInt1);
}
int getKey(int i)
{
int j = i >> 0x10 & 0xff;
int k = i >> 8 & 0xff;
int l = i & 0xff;
return (Func3(j, k, l) << 8) + l;
}
private void button1_Click(object sender, EventArgs e)
{
int Seed = 0xE3C56B;
int Key = getKey(Seed);
Key = getKey(0x3FD66B);
Key = getKey(0x29DB6B);
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Calculation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int Func3(int paramInt1, int paramInt2, int paramInt3)
{
int i = paramInt1 << 8 | paramInt2;
int j;
int k; int m; int n; int i1; switch (paramInt3)
{
case 65:
case 66:
case 67:
case 68:
case 69:
case 70:
case 71:
case 72:
case 73:
case 74:
case 75:
case 76:
case 77:
case 78:
case 79:
case 80:
case 81:
case 82:
case 83:
case 84:
case 85:
case 86:
case 87:
case 88:
case 89:
case 90:
case 91:
case 92:
case 93:
case 94:
case 95:
case 96:
default:
return 0;
case 1:
j = 20483;
k = 37495;
m = 19380;
n = 2;
i1 = -1;
break;
case 2:
j = 48737;
k = 29064;
m = 0;
n = -2;
i1 = 1;
break;
case 3:
j = 38851;
k = 17007;
m = 57213;
n = 2;
i1 = -1;
break;
case 4:
j = 38191;
k = 42963;
m = 45416;
n = -3;
i1 = 1;
break;
case 5:
j = 31893;
k = 60216;
m = 0;
n = 1;
i1 = -2;
break;
case 6:
j = 26458;
k = 15181;
m = 11362;
n = -3;
i1 = 1;
break;
case 7:
j = 10773;
k = 36766;
m = 28592;
n = 2;
i1 = -1;
break;
case 8:
j = 13376;
k = 4967;
m = 62941;
n = 2;
i1 = -3;
break;
case 9:
j = 2197;
k = 24862;
m = 65475;
n = -2;
i1 = 3;
break;
case 10:
j = 31199;
k = 59852;
m = 0;
n = 1;
i1 = -3;
break;
case 11:
j = 45383;
k = 9690;
m = 0;
n = 3;
i1 = -2;
break;
case 12:
j = 34146;
k = 59163;
m = 0;
n = -1;
i1 = 2;
break;
case 13:
j = 62765;
k = 33340;
m = 5749;
n = 3;
i1 = -1;
break;
case 14:
j = 45458;
k = 44092;
m = 0;
n = -1;
i1 = 3;
break;
case 15:
j = 37357;
k = 39321;
m = 0;
n = -2;
i1 = 1;
break;
case 16:
j = 8713;
k = 454;
m = 23575;
n = 1;
i1 = -2;
break;
case 17:
j = 9988;
k = 56677;
m = 29637;
n = -3;
i1 = 1;
break;
case 18:
j = 57758;
k = 34088;
m = 11152;
n = 1;
i1 = -3;
break;
case 19:
j = 33800;
k = 14769;
m = 0;
n = -2;
i1 = 1;
break;
case 20:
j = 4069;
k = 4013;
m = 24616;
n = -1;
i1 = 2;
break;
case 21:
j = 17056;
k = 12969;
m = 11927;
n = 3;
i1 = -1;
break;
case 22:
j = 31370;
k = 60592;
m = 0;
n = -1;
i1 = 3;
break;
case 23:
j = 24184;
k = 58486;
m = 0;
n = -1;
i1 = 3;
break;
case 24:
j = 56838;
k = 5012;
m = 35563;
n = 2;
i1 = -3;
break;
case 25:
j = 49473;
k = 5452;
m = 33161;
n = 3;
i1 = -2;
break;
case 26:
j = 64459;
k = 44104;
m = 0;
n = 2;
i1 = -1;
break;
case 27:
j = 6123;
k = 30247;
m = 0;
n = -1;
i1 = 3;
break;
case 28:
j = 62885;
k = 57915;
m = 28211;
n = -2;
i1 = 3;
break;
case 29:
j = 56790;
k = 34537;
m = 0;
n = -3;
i1 = 1;
break;
case 30:
j = 34655;
k = 4726;
m = 0;
n = 3;
i1 = -1;
break;
case 31:
j = 45667;
k = 2227;
m = 0;
n = -3;
i1 = 1;
break;
case 32:
j = 64118;
k = 22124;
m = 0;
n = 1;
i1 = -3;
break;
case 33:
j = 20483;
k = 37495;
m = 19380;
n = 2;
i1 = -1;
break;
case 34:
j = 18934;
k = 33007;
m = 45671;
n = -1;
i1 = 2;
break;
case 35:
j = 53898;
k = 43937;
m = 8992;
n = 3;
i1 = -2;
break;
case 36:
j = 26472;
k = 30849;
m = 15462;
n = -2;
i1 = 3;
break;
case 37:
j = 18864;
k = 16973;
m = 0;
n = -2;
i1 = 2;
break;
case 38:
j = 10153;
k = 24758;
m = 0;
n = -2;
i1 = 2;
break;
case 39:
j = 28031;
k = 31768;
m = 65233;
n = 3;
i1 = -1;
break;
case 40:
j = 9577;
k = 32816;
m = 0;
n = -3;
i1 = 3;
break;
case 41:
j = 33294;
k = 41833;
m = 63823;
n = 2;
i1 = -2;
break;
case 42:
j = 46258;
k = 33763;
m = 47869;
n = 2;
i1 = -2;
break;
case 43:
j = 303;
k = 15452;
m = 49261;
n = -3;
i1 = 1;
break;
case 44:
j = 14480;
k = 52729;
m = 0;
n = 2;
i1 = -2;
break;
case 45:
j = 26181;
k = 30558;
m = 11669;
n = -1;
i1 = 1;
break;
case 46:
j = 57729;
k = 31412;
m = 0;
n = 3;
i1 = -3;
break;
case 47:
j = 38273;
k = 42785;
m = 57170;
n = 2;
i1 = -3;
break;
case 48:
j = 65304;
k = 24702;
m = 12077;
n = 2;
i1 = -1;
break;
case 49:
j = 25997;
k = 16247;
m = 11573;
n = -2;
i1 = 3;
break;
case 50:
j = 47122;
k = 17812;
m = 0;
n = 3;
i1 = -1;
break;
case 51:
j = 62790;
k = 184;
m = 43056;
n = -2;
i1 = 1;
break;
case 52:
j = 27811;
k = 36172;
m = 10312;
n = -1;
i1 = 2;
break;
case 53:
j = 33495;
k = 4706;
m = 23772;
n = 1;
i1 = -3;
break;
case 54:
j = 11806;
k = 6016;
m = 0;
n = 2;
i1 = -1;
break;
case 55:
j = 23022;
k = 61027;
m = 0;
n = 1;
i1 = -3;
break;
case 56:
j = 14502;
k = 52925;
m = 45502;
n = -3;
i1 = 2;
break;
case 57:
j = 19654;
k = 47349;
m = 29195;
n = 3;
i1 = -2;
break;
case 58:
j = 4043;
k = 49055;
m = 0;
n = 1;
i1 = -2;
break;
case 59:
j = 238;
k = 61025;
m = 46052;
n = -2;
i1 = 3;
break;
case 60:
j = 26525;
k = 16314;
m = 0;
n = 2;
i1 = -1;
break;
case 61:
j = 27577;
k = 18161;
m = 3841;
n = -3;
i1 = 1;
break;
case 62:
j = 11820;
k = 48834;
m = 24936;
n = -3;
i1 = 2;
break;
case 63:
j = 926;
k = 34536;
m = 62639;
n = -1;
i1 = 1;
break;
case 64:
j = 34242;
k = 21476;
m = 0;
n = 2;
i1 = -3;
break;
case 97:
j = 11937;
k = 0;
m = 54278;
n = 3;
i1 = -1;
break;
case 98:
j = 11129;
k = 0;
m = 41060;
n = 1;
i1 = -3;
break;
case 99:
j = 16232;
k = 0;
m = 37025;
n = 3;
i1 = -2;
break;
case 100:
j = 62287;
k = 21359;
m = 0;
n = -1;
i1 = 1;
break;
case 101:
j = 19345;
k = 63583;
m = 20313;
n = -2;
i1 = 2;
break;
case 102:
j = 50636;
k = 34432;
m = 58878;
n = -2;
i1 = 2;
break;
case 103:
j = 8636;
k = 42038;
m = 0;
n = 3;
i1 = -1;
break;
case 104:
j = 49296;
k = 0;
m = 23727;
n = -2;
i1 = 2;
break;
case 105:
j = 62603;
k = 0;
m = 7632;
n = 2;
i1 = -1;
break;
case 106:
j = 54947;
k = 13952;
m = 0;
n = -3;
i1 = 2;
break;
case 107:
j = 46336;
k = 0;
m = 32973;
n = -1;
i1 = 3;
break;
case 108:
j = 31276;
k = 0;
m = 41988;
n = -2;
i1 = 2;
break;
case 109:
j = 24959;
k = 31354;
m = 55064;
n = 1;
i1 = -1;
break;
case 110:
j = 39963;
k = 29660;
m = 0;
n = 2;
i1 = -3;
break;
case 111:
j = 16360;
k = 6010;
m = 0;
n = 1;
i1 = -2;
break;
case 112:
j = 50050;
k = 36355;
m = 34628;
n = 3;
i1 = -3;
break;
}
return Func2(i, j, k, m, n, i1);
}
int Func2(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
{
int i = paramInt1 + paramInt2 & 0xFFFF;
int j = Func1(paramInt5, i);
int k = paramInt1 + paramInt3 & 0xFFFF;
int m = Func1(paramInt6, k);
int n = j * m;
int i1 = n + paramInt4;
return i1 & 0xFFFF;
}
int Func1(int paramInt1, int paramInt2)
{
if (paramInt1 > 0)
{
return 0xFFFF & (paramInt2 << paramInt1 | paramInt2 >> 16 - paramInt1);
}
return 0xFFFF & (paramInt2 >> -paramInt1 | paramInt2 << 16 + paramInt1);
}
int getKey(int i)
{
int j = i >> 0x10 & 0xff;
int k = i >> 8 & 0xff;
int l = i & 0xff;
return (Func3(j, k, l) << 8) + l;
}
private void button1_Click(object sender, EventArgs e)
{
int Seed = 0xE3C56B;
int Key = getKey(Seed);
Key = getKey(0x3FD66B);
Key = getKey(0x29DB6B);
}
}
}
Not a coder - but it looks like it was written by someone like me who doesn’t know how to code but can kludge a small piece of working code into a ungodly and huge messy but working thing.
On that basis, one can assume that it’s used by hmrc to determine someone’s IR35 eligibility?
I’d expect a pro to create a more sophisticated lookup table and a handful of lines of code to do the same thing - and always ensure the result is ‘outside’
On that basis, one can assume that it’s used by hmrc to determine someone’s IR35 eligibility?
I’d expect a pro to create a more sophisticated lookup table and a handful of lines of code to do the same thing - and always ensure the result is ‘outside’
Yes, it's easy enough to translate but there are many 'cases' (it's a strange way to write it!) so you really need to give us more context to give a sensible answer. It looks like it is taking some parameters and then using them to produce a 'code' as a result. From what type of application is it?
I really don’t want to sound like a plonker, but this OP has my antenna twitching. You say you’re an experienced programmer and you can easily translate this into your chosen programming language once you understand what it does - and yet the code is algorithmically trivial and there’s nothing in there that couldn’t be read by someone who understands basic python - it’s just maths and bit shifting/masking. (which is just multiplication and rounding). If you can’t read python or C then what are your choices of language?
Also this program is that it’s been written to generate keys from seeds yet the seeds have been hard coded causing most of the complexity to drop out.
Also this program is that it’s been written to generate keys from seeds yet the seeds have been hard coded causing most of the complexity to drop out.
I've never used python sadly.
Mainly Pic Basic nowadays and assembler years ago.
It's the C syntax/layout which is confusing maybe I could unpick it, as you say the actual maths is probably relatively simple.
Just hoping to get it into something more readable to give me a head start.
Mainly Pic Basic nowadays and assembler years ago.
It's the C syntax/layout which is confusing maybe I could unpick it, as you say the actual maths is probably relatively simple.
Just hoping to get it into something more readable to give me a head start.
peterperkins said:
I've never used python sadly.
Mainly Pic Basic nowadays and assembler years ago.
It's the C syntax/layout which is confusing maybe I could unpick it, as you say the actual maths is probably relatively simple.
Just hoping to get it into something more readable to give me a head start.
Ok yes that’s fair enough.Mainly Pic Basic nowadays and assembler years ago.
It's the C syntax/layout which is confusing maybe I could unpick it, as you say the actual maths is probably relatively simple.
Just hoping to get it into something more readable to give me a head start.
I’m babysitting my five year old at the moment but if no one else has done this this evening I’ll have a crack at refactoring for you. Alas because of the way it’s written and without any context it’s unlikely to be much reduced in size - all the hardcoded numbers and bit manipulation steps are going to still be necessary.
I’ll try and find some pic basic docs and see what I can do
I’ll try and find some pic basic docs and see what I can do
I love the people saying it is "easy" and "trivial" and then not explaining what it does.
I've had a look and it appears to be doing some kind of shift operations. I have never done that before and have no idea what it means. Try reading the below and then looking at the getKey function as an example.
https://docs.microsoft.com/en-us/dotnet/csharp/lan...
Once you understand the shift operators, you should be able to recreate it in another language. If you're really lucky, the syntax might even be the same and you can simply copy and paste.
This may also be of help:
https://stackoverflow.com/questions/14713102/what-...
As said above, you can run the code in Visual Studio, which will show you "what" the functions are doing and the values returned, but it won't explain "why" they are doing it.
I've had a look and it appears to be doing some kind of shift operations. I have never done that before and have no idea what it means. Try reading the below and then looking at the getKey function as an example.
https://docs.microsoft.com/en-us/dotnet/csharp/lan...
Once you understand the shift operators, you should be able to recreate it in another language. If you're really lucky, the syntax might even be the same and you can simply copy and paste.
This may also be of help:
https://stackoverflow.com/questions/14713102/what-...
As said above, you can run the code in Visual Studio, which will show you "what" the functions are doing and the values returned, but it won't explain "why" they are doing it.
until then... I wonder if removing the magic value setting, and spacing things out helps you read it a bit?
int Func3(int paramInt1, int paramInt2, int paramInt3)
{
int i = paramInt1 << 8 | paramInt2;
int j;
int k; int m; int n; int i1;
j,k,m,n,i1 = set_params(paramInt3)
return Func2(i, j, k, m, n, i1);
}
int Func2(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
{
int i = paramInt1 + paramInt2 & 0xFFFF;
int j = Func1(paramInt5, i);
int k = paramInt1 + paramInt3 & 0xFFFF;
int m = Func1(paramInt6, k);
int n = j * m;
int i1 = n + paramInt4;
return i1 & 0xFFFF;
}
int Func1(int paramInt1, int paramInt2)
{
if (paramInt1 > 0)
{
return 0xFFFF & (paramInt2 << paramInt1 | paramInt2 >> 16 - paramInt1);
}
return 0xFFFF & (paramInt2 >> -paramInt1 | paramInt2 << 16 + paramInt1);
}
int getKey(int i)
{
int j = i >> 0x10 & 0xff;
int k = i >> 8 & 0xff;
int l = i & 0xff;
return (Func3(j, k, l) << 8) + l;
}
private void button1_Click(object sender, EventArgs e)
{
int Seed = 0xE3C56B;
int Key = getKey(Seed);
}
int Func3(int paramInt1, int paramInt2, int paramInt3)
{
int i = paramInt1 << 8 | paramInt2;
int j;
int k; int m; int n; int i1;
j,k,m,n,i1 = set_params(paramInt3)
return Func2(i, j, k, m, n, i1);
}
int Func2(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
{
int i = paramInt1 + paramInt2 & 0xFFFF;
int j = Func1(paramInt5, i);
int k = paramInt1 + paramInt3 & 0xFFFF;
int m = Func1(paramInt6, k);
int n = j * m;
int i1 = n + paramInt4;
return i1 & 0xFFFF;
}
int Func1(int paramInt1, int paramInt2)
{
if (paramInt1 > 0)
{
return 0xFFFF & (paramInt2 << paramInt1 | paramInt2 >> 16 - paramInt1);
}
return 0xFFFF & (paramInt2 >> -paramInt1 | paramInt2 << 16 + paramInt1);
}
int getKey(int i)
{
int j = i >> 0x10 & 0xff;
int k = i >> 8 & 0xff;
int l = i & 0xff;
return (Func3(j, k, l) << 8) + l;
}
private void button1_Click(object sender, EventArgs e)
{
int Seed = 0xE3C56B;
int Key = getKey(Seed);
}
CzechItOut said:
I love the people saying it is "easy" and "trivial" and then not explaining what it does.
Well, we're not being facetious - we're saying that the steps the code follows is simple. it is literally just defining some numbers and then manipulating them by adding them together, multipying and rounding. We have no idea what it does; my guess is some kind of industrial control machinery perhaps.Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff



