The degree of difficulty for mining is determined by a 256-bit number. The block headers contain a maximum hash value that miners must be under in order to have blocks generated as part of their proof of work. This basically means that a smaller hash value target is more competitive for inclusion. If the target is a low number, difficulty increases. For Bitcoin, the target is adjusted once every 2,016 blocks (two weeks). The index of difficulty at the time of mining is simply the maximum possible value divided by the current target.