#!/usr/bin/env python import utils dh2048g = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF # Add one, we need a ceil function, but plus one for such big numbers is good enough. dh2048g_r = ((1 << 4096) / dh2048g) + 1 print utils.grouped_hex(dh2048g_r)
#!/usr/bin/env python import utils a= 0x64CFCAC5F1872E51B1F9FBB5BF16FBE79689FC0903A801E3D4802FB8D329550DC8C9D3D922EECE9A5475DB33DB7B83BB5C0E13D168049BBC86C5817647B088D1EAC9BE0B31EB318540E4069D556E9DD09D5D89D7DE4A75C88BB49316C106E4E014B636E60FEBC292E6249105F5B195FE906EEF7D26C90A17477122CE125FB665 b= 0xffffffffffffffffffffffffffffffffeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeddddddddddddddddccccccccccccccccbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaa999999998888888877777777666666665555555544444444333333332222222211110000ffffeeeeddddccccbbbbaaaa99998888777766665555444433332222 c = 0x64CFCAC5F1872E51B1F9FBB5FFFFFFFF8FD1770CE27CDCAB2F091EF0F99F444295E5F9CB56DA983055D75352FFFFFFFFCBA5B475D12335B045491E6EB88FCCC28A57E2B76E3D255E50662357FFFFFFFF4F1018F38C59914C509147CD59C5B9AAE8E0FD01200AF4BEEA1F6ECDFFFFFFFF923F74E4794B3790745274EB4B4BC7B4A4DDFE0419DA4A22F28A2A3AFFFFFFFFE282906CD83F92957034BCE5DB140EE1BB60E2AB8BBACBBBC67D944AFFFFFFFF4072E2CF3644802B5D43C4AEEDD493913C9BED9598B9F6FAF2ACFE94FFFFFFFF050CFA9E6539D73D767075881DFBF53945198CC1BF64F8CFF2588FE5FFFFFFFFD61DEA79B27CFB40E6C4FF0A9C0EA36A print "a + b\n", utils.grouped_hex(a + b) print "b - a\n", utils.grouped_hex(b - a) print "a * 0xfedcba9876543210\n", utils.grouped_hex(a * 0xfedcba9876543210) print "a * b\n", utils.grouped_hex(a * b) print "(a << 2048 / b) + 1\n", utils.grouped_hex(((1 << 2048) / b) + 1) print "c % b\n", utils.grouped_hex(c % b)