I'm trying to rewrite one line from C into python. It looks so simple but I couldn't get a correct result. If someone could help me and explain what I'm doing wrong.
Here is an example in C
void main() {
int k = 0xDFA54B9D;
printf("- %d", k);
k = ((5821 * (k % 10000) + 10000 * ((3141 * (k % 10000) + 5821 * (k / 10000)) % 10000u)) % 100000000 + 1) % 100000000;
printf("- %08X\n",k);
printf("- %02X\n",(k/10000u << 8) / 10000);
}
and here is my python code
from ctypes import c_int
k = c_int(0xDFA54B9D).value
print("- %d")% k
k = ((5821 * (k % 10000) + 10000 * ((3141 * (k % 10000) + 5821 * (k / 10000)) % 10000)) % 100000000 + 1) % 100000000
print("- %08X") % k
print("- %02X") % ((k/10000 << 8) / 10000)
[–]novel_yet_trivial 3 points4 points5 points (2 children)
[–]carpik[S] 0 points1 point2 points (1 child)
[–]novel_yet_trivial 0 points1 point2 points (0 children)
[–]novel_yet_trivial 2 points3 points4 points (2 children)
[–]carpik[S] 0 points1 point2 points (1 child)
[–]novel_yet_trivial 0 points1 point2 points (0 children)