fork download
  1. #include <iostream>
  2. #include <bitset>
  3.  
  4. void split_bitset( std::bitset<56> &p, std::bitset<28> &left, std::bitset<28> &right ) {
  5. uint64_t uikey = p.to_ullong();
  6.  
  7. left = uikey >> 28;
  8. right = uikey & 0xFFFFFFF;
  9. }
  10.  
  11. int main() {
  12.  
  13. std::bitset<56> permutationKey(0x133457799BBCDF);
  14. std::bitset<28> leftKey;
  15. std::bitset<28> rightKey;
  16.  
  17. split_bitset(permutationKey,leftKey,rightKey);
  18. std::cout << permutationKey << '\n' << leftKey << '\n' << rightKey << '\n';
  19. return 0;
  20. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
00010011001101000101011101111001100110111011110011011111
0001001100110100010101110111
1001100110111011110011011111