MCPcopy Create free account
hub / github.com/crossuo/crossuo / F32

Function F32

src/Crypt/GameCrypt.cpp:635–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

633// clang-format on
634
635static unsigned int F32(unsigned int x, unsigned int *k32, int keyLen)
636{
637 unsigned char b[4];
638
639 *((unsigned int *)b) = Bswap(x);
640 switch (((keyLen + 63) / 64) & 3)
641 {
642 case 0:
643 b[0] = p8(04)[b[0]] ^ _b(k32[3], 0);
644 b[1] = p8(14)[b[1]] ^ _b(k32[3], 1);
645 b[2] = p8(24)[b[2]] ^ _b(k32[3], 2);
646 b[3] = p8(34)[b[3]] ^ _b(k32[3], 3);
647 // fall through
648 case 3:
649 b[0] = p8(03)[b[0]] ^ _b(k32[2], 0);
650 b[1] = p8(13)[b[1]] ^ _b(k32[2], 1);
651 b[2] = p8(23)[b[2]] ^ _b(k32[2], 2);
652 b[3] = p8(33)[b[3]] ^ _b(k32[2], 3);
653 // fall through
654 case 2:
655 b[0] = p8(00)[p8(01)[p8(02)[b[0]] ^ _b(k32[1], 0)] ^ _b(k32[0], 0)];
656 b[1] = p8(10)[p8(11)[p8(12)[b[1]] ^ _b(k32[1], 1)] ^ _b(k32[0], 1)];
657 b[2] = p8(20)[p8(21)[p8(22)[b[2]] ^ _b(k32[1], 2)] ^ _b(k32[0], 2)];
658 b[3] = p8(30)[p8(31)[p8(32)[b[3]] ^ _b(k32[1], 3)] ^ _b(k32[0], 3)];
659 }
660
661 return ((M00(b[0]) ^ M01(b[1]) ^ M02(b[2]) ^ M03(b[3]))) ^
662 ((M10(b[0]) ^ M11(b[1]) ^ M12(b[2]) ^ M13(b[3])) << 8) ^
663 ((M20(b[0]) ^ M21(b[1]) ^ M22(b[2]) ^ M23(b[3])) << 16) ^
664 ((M30(b[0]) ^ M31(b[1]) ^ M32(b[2]) ^ M33(b[3])) << 24);
665}
666
667static unsigned int RS_MDS_Encode(unsigned int k0, unsigned int k1)
668{

Callers 2

reKeyFunction · 0.85
blockEncryptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected