Network Working Group R. Elz
Request for Comments: 1924 University of Melbourne
Category: Informational 1 April 1996
A Compact Representation of IPv6 Addresses
1. Abstract
IPv6 addresses, being 128 bits long, need 32 characters to write in the general case, if standard hex representation, is used, plus more for any punctuation inserted (typically about another 7 characters, or 39 characters total). This document specifies a more compact representation of IPv6 addresses, which permits encoding in a mere 20 bytes.
2. Introduction
It is always necessary to be able to write in characters the form of an address, though in actual use it is always carried in binary. For IP version 4 (IP Classic) the well known dotted quad format is used. That is, 10.1.0.23 is one such address. Each decimal integer represents a one octet of the 4 octet address, and consequently has a value between 0 and 255 (inclusive). The written length of the address varies between 7 and 15 bytes.
Elz Informational [Page 1]
RFC 1924 A Compact Representation of IPv6 Addresses 1 April 1996
This document specifies a new encoding, which can always represent any IPv6 address in 20 octets. While longer than the shortest possible representation of an IPv6 address, this is barely longer than half the longest representation, and will typically be shorter than the representation of most IPv6 addresses.
3. Current formats
[AddrSpec] specifies that the preferred text representation of IPv6 addresses is in one of three conventional forms.
Elz Informational [Page 2]
RFC 1924 A Compact Representation of IPv6 Addresses 1 April 1996 4. The New Encoding FormatThe new standard way of writing IPv6 addresses is to treat them as a 128 bit integer, encode that in base 85 notation, then encode that using 85 ASCII characters.
4.1. Why 85?
2^128 is 340282366920938463463374607431768211456. 85^20 is 387595310845143558731231784820556640625, and thus in 20 digits of base 85 representation all possible 2^128 IPv6 addresses can clearly be encoded.
4.2. The Character Set
The character set to encode the 85 base85 digits, is defined to be, in ascending order:
Elz Informational [Page 3]
RFC 1924 A Compact Representation of IPv6 Addresses 1 April 1996
',' to allow lists of IPv6 addresses to conveniently be written, and '.' to allow an IPv6 address to end a sentence without requiring it to be quoted.
5. Converting an IPv6 address to base 85.
The conversion process is a simple one of division, taking the remainders at each step, and dividing the quotient again, then reading up the page, as is done for any other base conversion.
Elz Informational [Page 4]
RFC 1924 A Compact Representation of IPv6 Addresses 1 April 1996 6. Additional BenefitApart from generally reducing the length of an IPv6 address when encode in a textual format, this scheme also has the benefit of returning IPv6 addresses to a fixed length representation, leading zeroes are never omitted, thus removing the ugly and awkward variable length representation that has previously been recommended.
7. Implementation Issues
Many current processors do not find 128 bit integer arithmetic, as required for this technique, a trivial operation. This is not considered a serious drawback in the representation, but a flaw of the processor designs.
8. Security Considerations
By encoding addresses in this form, it is less likely that a casual observer will be able to immediately detect the binary form of the address, and thus will find it harder to make immediate use of the address. As IPv6 addresses are not intended to be learned by humans, one reason for which being that they are expected to alter in comparatively short timespan, by human perception, the somewhat challenging nature of the addresses is seen as a feature.
Elz Informational [Page 5]
RFC 1924 A Compact Representation of IPv6 Addresses 1 April 1996 9. References[IPv6] Internet Protocol, Version 6 (IPv6) Specification,
10. Author's Address
Robert Elz Computer Science University of Melbourne Parkville, Victoria, 3052 Australia