14

In cryptography, we often write as "AES has 128-bit key" and "AES provides 128 bits of security"

Is there any difference between writing 128-bit and 128 bits? What is the correct choice?

Example; From Lindell & Katz's book;

  • AES supports 128-, 192-,or 256-bit keys, and a block length of 128 bits
  • The minimum recommended key length nowadays is 128 bits.
7
  • 3
    Does this answer your question? Using hyphens between numbers and units before long and wide Jan 4, 2021 at 19:39
  • In that case I suggest asking on a specialised site, if you think this falls outside the general practice. Jan 5, 2021 at 14:23
  • 1
    AES128 provides 126 bits of security. I don't know why it's 126 not 127 but that's what they say. A perfect cipher of 128 bits would yield 127 bits of security.
    – Joshua
    Jan 5, 2021 at 17:58
  • 1
    @Joshua, because there's an attack on AES-128 that allows the key to be retrieved with "only" 2^126 operations: en.wikipedia.org/wiki/Biclique_attack Or at least in theory, since it's still outside the realm of anything that can be calculated in this solar system.
    – ilkkachu
    Jan 5, 2021 at 21:57
  • @ilkkachu actually Tao at. al totally compared their attack against the brute-force attack by comparing each of the operations. That is one of the fine calculated attack. Actually, the real thread is coming from the multi-taget attack against the AES-128
    – kelalaka
    Jan 5, 2021 at 22:03

6 Answers 6

23

Often, we can use a compound hyphenated adjective as an alternative to a longer phrase meaning the same thing. The correct choice may depend on the level of the writing - more technical readers may understand at once what a '128-bit key' is, especially if the idea has been explained already.

A hundred-tonne load

A load of one hundred tonnes

A 128-bit key

A key with 128 bits of security

How to use a hyphen (Lexico)

3
  • 2
    In terms of meaning, the following two sentences are the same. 1. AES provides 128 bits of security and 2. AES provides 128-bit security - The reasoning is explained in Michael Harvey's answer above. Jan 4, 2021 at 20:07
  • 22
    It's worth noting that "A 128-bit key" more likely just means "A key that's 128 bits long", while the effective security level can be lower. For example, RSA with "a 2048-bit key" certainly doesn't provide 2048 "bits of security".
    – ManfP
    Jan 5, 2021 at 8:10
  • 3
    The example our English teacher used was "a five-hour-long movie is five hours long."
    – Flater
    Jan 6, 2021 at 14:24
17
Has Hyphen Is Singular Type of Word
x-bit yes yes adjective
1 bit - yes noun
y bits - - noun

x is any number
y is any number except 1

The chart above is basically true for most countable nouns in English in general. This includes nouns like "dog", "cat", "house", "car", "person", etc. In your question, you gave two examples:

AES has [a] 128-bit key - Here, "128-bit" is used like an adjective. That is the reason it does not have an "s" (despite being a number other than 1), but does have a hyphen.

AES provides 128 bits of security - Here, "128 bits" is used like a noun. That is the reason it does have an "s", but does not have a hyphen.

5
  • 2
    Also worth noting that in informal usage the hyphen may be (incorrectly) dropped from the adjectival form.
    – Steve
    Jan 6, 2021 at 8:37
  • I don't like this answer for some reason. Although the information is not incorrect, I think the terse table presentation is worse than KRyan's explanation.
    – user253751
    Jan 6, 2021 at 17:12
  • Re "any number": I think "any positive integer" (or whole numbers or counting numbers) would be more precise. Numbers can be negative, rational (fractional), irrational, and even complex. Jan 7, 2021 at 8:26
  • 1
    -5 degrees, 2.5 degrees, etc. It doesn't have to be a positive integer for the grammatical rule to work. Jan 7, 2021 at 12:42
  • 1
    @PeterMortensen "2.5-kilogram rock", "-5-degree room" / "negative-5-degree-Celsius room", "In order to make a circle of 1-meter radius, we need a 2π-meter rope". I don't know enough science to know if complex numbers can ever be used with some type of physical unit.
    – JoL
    Jan 7, 2021 at 18:03
9

The hyphenated phrase “128-bit” is, all together, an adjective. The hyphen indicates that it is being used in this manner. As an adjective, it modifies the noun “key.” These kinds of hyphenated adjectival phrases are very common, often with units of measure (“128-bit,” “12-inch,” “100-gram,” “5-hour,” and so on), and they always use the singular form of the unit in their construction.

Meanwhile, in “128 bits,” we have an adjective—the number “128”—and a noun, “bits.” Because the number is not 1, the noun is plural, hence “bits” and not “bit.”

Since I did mention that the above construction is common with units of measure, I should note that when you use the International System of Units (SI) abbreviations (m, g, s, etc.), those aren’t pluralized. This is an SI rule, though, not an English-language one—in fact, you see that traditional English units often do pluralize even unit abbreviation, as in “5 lbs.” for “5 pounds” vs. “1 lb.” for “1 pound.” But we don’t do this with the hyphenated construction, for instance “a 5-lb. dog.”

Which to use depends on context and style. For instance, if you were differentiating between two different things of a given measure, like a “5-lb. dog” vs. a “5-lb. cat,” the adjectival-phrase version, as I’ve used here, is much easier to read and write. Otherwise you’d have to say something like “the dog that is 5 lbs.” vs. “the cat that is 5 lbs.,” which is very unwieldy. In other cases, it’s easier to not do that, for example, “we have two keys, one with 128 bits and another with 256.” But it largely comes down to style and what exactly you’re trying to say, which will sound or read better.

4
  • 2
    You could say "5 pounds of dog" but it would be very strange, because it treats "dog" as a mass noun. You could use it in humour.
    – user253751
    Jan 5, 2021 at 17:17
  • @user253751 Yeah, that makes it sound like you’re talking about dog meat.
    – KRyan
    Jan 5, 2021 at 18:20
  • I'd sooner write 'a 5 lb dog' or 'a five-pound dog'. Jan 5, 2021 at 18:51
  • 2
    @KRyan also said for emphasis: "eight pounds of hair, and five pounds of dog" describing a very furry dog.
    – RonJohn
    Jan 7, 2021 at 4:29
3

The correct choice is nearly always 'bit', not 'bits', and you would include the hyphen.

In your example of "128-bit security", '128-bit' is a compound noun acting as an adjective, effectively describing the level of encryption technology providing the security.

A comparable example would be "a 12-inch pizza". We never say "12 inches of pizza". You could say "this pizza is 12 inches in diameter" and it would be grammatically correct, but overly complex.

7
  • 3
    We do measure security of cryptographic algorithms in bits though. Generally the security is at best equivilent to the key length but it can sometimes be considerablly lower. Jan 5, 2021 at 4:23
  • 2
    @PeterGreen Agreed, I tried to keep it in simple terms and I did state that you can measure a security key in bits, but that isn't a measure of security strength itself from an end-user perspective, just like megapixels are not a measurement of screen size.
    – Astralbee
    Jan 5, 2021 at 8:51
  • In scientific work it is incorrect to give a length as 5 metres; it should be 5 metre. This is contrary to the usual correct practice. The reason is that the measurement is 5 times a unit metre, not a collection of 5 distinguishable metres. The same principle can be used to say that a key is 128 bit long. However many people follow the usual English practice and say bits (or metres), and you may expect many people on an English language site to expect the plural word.
    – Peter
    Jan 5, 2021 at 10:18
  • 2
    also, I don't think "the security uses a 128-bit key" is a sensible phrase, as "security" isn't something that can "use" anything. An algorithm, protocol or a program can of course use a key of a particular length.
    – ilkkachu
    Jan 5, 2021 at 11:42
  • 2
    @Peter I've never heard a scientist say "the length of this room is 5 metre". Citation needed? ("a 5-metre room" is normal, though, not "a 5-metres room")
    – user253751
    Jan 5, 2021 at 17:15
3

As an adjective it is hyphenated:

  • a 3-bedroom apartment
  • an 18-inch tire
  • a 128-bit key
  • 99-bit security

As a noun it is not hyphenated:

  • an apartment with 3 bedrooms
  • a tire with diameter of 18 inches
  • a key with length of 128 bits
  • security with strength of 99 bits

In titles and in advertising it is often ignored.

2

A very simple explanation:

  • 128-bit is together an adjective that describes a characteristic of something, for example:

    "We use 128-bit encryption."

    ... where "128-bit" is the adjective describing the noun "encryption".

  • "128 bits" is a number followed by a noun. It together describes the number (amount) of bits present, for example:

    "There are 128 bits available".

    ... where "128" is a number specifying how many "bits", that is a noun, is present.

Therefore, both sentences in Lindell & Katz's book are correct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .