Search code examples
ccryptographycpu-usagebitgmp

cpu power consumption and set bits


I'm working on side channel attack on prime number generation by measuring power consumed by the cpu while doing that, let's say that the cpu process 10000 mpz_t integer ( size 512 ) does the number of set bits (Hamming weight) in those integers have anything to do with power consumption by the cpu?, in other words a 512 bits integer with 500 set bits is going to consume more power than a 512 bits integer with only 10 set bits?


Solution

  • Yes, that's the general idea. There are of course tricks to minimize the difference between a 0 and 1 bit, but without measurements against side channel attacks, a zero bit will be faster than a bit set to one during (modular) multiplication - basically because, for multiplication - nothing needs to be calculated.