MCPcopy Create free account
hub / github.com/LUX-Core/lux / IPERM

Function IPERM

src/cryptopp/des.cpp:76–96  ·  view source on GitHub ↗

Wei Dai's modification to Richard Outerbridge's initial permutation algorithm, this one is faster if you have access to rotate instructions (like in MSVC)

Source from the content-addressed store, hash-verified

74// algorithm, this one is faster if you have access to rotate instructions
75// (like in MSVC)
76static inline void IPERM(word32 &left, word32 &right)
77{
78 word32 work;
79
80 right = rotlFixed(right, 4U);
81 work = (left ^ right) & 0xf0f0f0f0;
82 left ^= work;
83 right = rotrFixed(right^work, 20U);
84 work = (left ^ right) & 0xffff0000;
85 left ^= work;
86 right = rotrFixed(right^work, 18U);
87 work = (left ^ right) & 0x33333333;
88 left ^= work;
89 right = rotrFixed(right^work, 6U);
90 work = (left ^ right) & 0x00ff00ff;
91 left ^= work;
92 right = rotlFixed(right^work, 9U);
93 work = (left ^ right) & 0xaaaaaaaa;
94 left = rotlFixed(left^work, 1U);
95 right ^= work;
96}
97
98static inline void FPERM(word32 &left, word32 &right)
99{

Callers 1

ProcessAndXorBlockMethod · 0.85

Calls 2

rotlFixedFunction · 0.85
rotrFixedFunction · 0.85

Tested by

no test coverage detected