Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here is a table showing the output from gmp_export given either gmp_init(0x0123456789ABCDEF) or gmp_init(-0x0123456789ABCDEF) and various inputs parameters on a little-endian 64-bit platform. NOTE that the underscores in the table are used to illustrate the separation between "word"s (which are either char/short/int/long).
- ╔══════╦═══════════╦═════╦════════╦═══════════════════════════════╗
- ║ Sign ║ Word Size ║ Sig ║ Endian ║ gmp_export Hex Result ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 1 bytes ║ MSW ║ little ║ 01_23_45_67_89_AB_CD_EF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 1 bytes ║ MSW ║ big ║ 01_23_45_67_89_AB_CD_EF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 1 bytes ║ LSW ║ little ║ EF_CD_AB_89_67_45_23_01 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 1 bytes ║ LSW ║ big ║ EF_CD_AB_89_67_45_23_01 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 2 bytes ║ MSW ║ little ║ 2301_6745_AB89_EFCD ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 2 bytes ║ MSW ║ big ║ 0123_4567_89AB_CDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 2 bytes ║ LSW ║ little ║ EFCD_AB89_6745_2301 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 2 bytes ║ LSW ║ big ║ CDEF_89AB_4567_0123 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 3 bytes ║ MSW ║ little ║ 230100_896745_EFCDAB ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 3 bytes ║ MSW ║ big ║ 000123_456789_ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 3 bytes ║ LSW ║ little ║ EFCDAB_896745_230100 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 3 bytes ║ LSW ║ big ║ ABCDEF_456789_000123 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 4 bytes ║ MSW ║ little ║ 67452301_EFCDAB89 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 4 bytes ║ MSW ║ big ║ 01234567_89ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 4 bytes ║ LSW ║ little ║ EFCDAB89_67452301 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 4 bytes ║ LSW ║ big ║ 89ABCDEF_01234567 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 5 bytes ║ MSW ║ little ║ 4523010000_EFCDAB8967 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 5 bytes ║ MSW ║ big ║ 0000012345_6789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 5 bytes ║ LSW ║ little ║ EFCDAB8967_4523010000 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 5 bytes ║ LSW ║ big ║ 6789ABCDEF_0000012345 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 6 bytes ║ MSW ║ little ║ 230100000000_EFCDAB896745 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 6 bytes ║ MSW ║ big ║ 000000000123_456789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 6 bytes ║ LSW ║ little ║ EFCDAB896745_230100000000 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 6 bytes ║ LSW ║ big ║ 456789ABCDEF_000000000123 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 7 bytes ║ MSW ║ little ║ 01000000000000_EFCDAB89674523 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 7 bytes ║ MSW ║ big ║ 00000000000001_23456789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 7 bytes ║ LSW ║ little ║ EFCDAB89674523_01000000000000 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 7 bytes ║ LSW ║ big ║ 23456789ABCDEF_00000000000001 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 8 bytes ║ MSW ║ little ║ EFCDAB8967452301 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 8 bytes ║ MSW ║ big ║ 0123456789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 8 bytes ║ LSW ║ little ║ EFCDAB8967452301 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ +pos ║ 8 bytes ║ LSW ║ big ║ 0123456789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 1 bytes ║ MSW ║ little ║ 01_23_45_67_89_AB_CD_EF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 1 bytes ║ MSW ║ big ║ 01_23_45_67_89_AB_CD_EF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 1 bytes ║ LSW ║ little ║ EF_CD_AB_89_67_45_23_01 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 1 bytes ║ LSW ║ big ║ EF_CD_AB_89_67_45_23_01 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 2 bytes ║ MSW ║ little ║ 2301_6745_AB89_EFCD ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 2 bytes ║ MSW ║ big ║ 0123_4567_89AB_CDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 2 bytes ║ LSW ║ little ║ EFCD_AB89_6745_2301 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 2 bytes ║ LSW ║ big ║ CDEF_89AB_4567_0123 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 3 bytes ║ MSW ║ little ║ 230100_896745_EFCDAB ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 3 bytes ║ MSW ║ big ║ 000123_456789_ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 3 bytes ║ LSW ║ little ║ EFCDAB_896745_230100 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 3 bytes ║ LSW ║ big ║ ABCDEF_456789_000123 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 4 bytes ║ MSW ║ little ║ 67452301_EFCDAB89 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 4 bytes ║ MSW ║ big ║ 01234567_89ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 4 bytes ║ LSW ║ little ║ EFCDAB89_67452301 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 4 bytes ║ LSW ║ big ║ 89ABCDEF_01234567 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 5 bytes ║ MSW ║ little ║ 4523010000_EFCDAB8967 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 5 bytes ║ MSW ║ big ║ 0000012345_6789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 5 bytes ║ LSW ║ little ║ EFCDAB8967_4523010000 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 5 bytes ║ LSW ║ big ║ 6789ABCDEF_0000012345 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 6 bytes ║ MSW ║ little ║ 230100000000_EFCDAB896745 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 6 bytes ║ MSW ║ big ║ 000000000123_456789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 6 bytes ║ LSW ║ little ║ EFCDAB896745_230100000000 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 6 bytes ║ LSW ║ big ║ 456789ABCDEF_000000000123 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 7 bytes ║ MSW ║ little ║ 01000000000000_EFCDAB89674523 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 7 bytes ║ MSW ║ big ║ 00000000000001_23456789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 7 bytes ║ LSW ║ little ║ EFCDAB89674523_01000000000000 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 7 bytes ║ LSW ║ big ║ 23456789ABCDEF_00000000000001 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 8 bytes ║ MSW ║ little ║ EFCDAB8967452301 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 8 bytes ║ MSW ║ big ║ 0123456789ABCDEF ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 8 bytes ║ LSW ║ little ║ EFCDAB8967452301 ║
- ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
- ║ -neg ║ 8 bytes ║ LSW ║ big ║ 0123456789ABCDEF ║
- ╚══════╩═══════════╩═════╩════════╩═══════════════════════════════╝
- See https://www.php.net/manual/en/gmp.constants.php for the full note.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement