A method of generating a message authentication code, MAC, of a consumable, including: generating a mask for converting a first binary number having a first number of bits to a second binary number having a second number of bits, said first number of bits being greater than said second number of bits, comprising the steps of: defining a key having a third number of bits, said third number of bits being divisible into said first number of bits to form a quotient; dividing said first binary number into a plurality of groups of bits, the number of said plurality of groups of bits being equal to said third number of bits of said key, each of said groups having a number of bits equal to a number of bits of said quotient; associating each bit of said key to one group of said plurality of groups of bits of said first binary number; selecting from said plurality of groups of bits of said first binary number each group having a corresponding key bit having a predetermined binary state; and selecting at least one bit from each selected group of bits based on a result of a modulo function applied to the key to form at least a portion of said second binary number; wherein said second binary number is the MAC for the consumable; and storing said second binary number in a memory of the consumable; and wherein said first binary number is a digest output of a hashing function. generating a mask for converting a first binary number having a first number of bits to a second binary number having a second number of bits, said first number of bits being greater than said second number of bits, comprising the steps of: defining a key having a third number of bits, said third number of bits being divisible into said first number of bits to form a quotient; dividing said first binary number into a plurality of groups of bits, the number of said plurality of groups of bits being equal to said third number of bits of said key, each of said groups having a number of bits equal to a number of bits of said quotient; associating each bit of said key to one group of said plurality of groups of bits of said first binary number; selecting from said plurality of groups of bits of said first binary number each group having a corresponding key bit having a predetermined binary state; and selecting at least one bit from each selected group of bits based on a result of a modulo function applied to the key to form at least a portion of said second binary number; wherein said second binary number is the MAC for the consumable; and storing said second binary number in a memory of the consumable; and wherein said first binary number is a digest output of a hashing function. defining a key having a third number of bits, said third number of bits being divisible into said first number of bits to form a quotient; dividing said first binary number into a plurality of groups of bits, the number of said plurality of groups of bits being equal to said third number of bits of said key, each of said groups having a number of bits equal to a number of bits of said quotient; associating each bit of said key to one group of said plurality of groups of bits of said first binary number; selecting from said plurality of groups of bits of said first binary number each group having a corresponding key bit having a predetermined binary state; and selecting at least one bit from each selected group of bits based on a result of a modulo function applied to the key to form at least a portion of said second binary number; wherein said second binary number is the MAC for the consumable; and storing said second binary number in a memory of the consumable; and wherein said first binary number is a digest output of a hashing function.