magic cookie

short packet of data passed between communicating programs

Uses your system voice; voice and rate in settings.

Q6730914Snapshot

≈ 3 min read

Names in other languages

  • Tiếng Việtbánh quy ma thuật
  • caGaleta màgicacookie
  • DeutschMagic-CookieMagic Cookie
  • Englishmagic cookiecookie
  • eomagia kuketo
  • Françaismagic cookiecookie
  • Italianomagic cookie
  • РусскийMagic cookie
  • 日本語マジッククッキークッキー
  • Bahasa Melayucecikut
  • barCookie
  • gswCookie

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

In computing, a magic cookie, or just cookie for short, is a token or short packet of data passed between communicating programs. The cookie is often used to identify a particular event or as "handle, transaction ID, or other token of agreement between cooperating programs".[1]

Usage

edit edit source

Cookie data is typically not meaningful to the recipient program. The contents are opaque and not usually interpreted until the recipient passes the cookie data back to the sender or perhaps another program at a later time.[citation needed]

In some cases, recipient programs are able to meaningfully compare two cookies for equality.[citation needed]

The cookie can be used like a ticket.[citation needed]

Early use

edit edit source

The term magic cookie appears in the man page for the fseek routine in the C standard library, dating back at least to 1979, where it was stated:

  • "ftell returns the current value of the offset relative to the beginning of the file associated with the named stream. It is measured in bytes on UNIX; on some other systems it is a magic cookie, and the only foolproof way to obtain an offset for fseek."[2][3][4]
edit edit source

An analogy is the token supplied at a coat check (cloakroom) counter in real life. The token has no intrinsic meaning, but its uniqueness allows it to be exchanged for the correct coat when returned to the coat check counter. The coat check token is opaque because the way in which the counter staff are able to find the correct coat when the token is presented is immaterial to the person who wishes their coat returned. In other cases (as is possible with HTTP cookies), the actual data of interest can be stored as name–value pairs directly on the cookie.

Cookies are used as identifying tokens in many computer applications. When one visits a website, the remote server may leave an HTTP cookie on one's computer, where they are often used to authenticate identity upon returning to the website.

Cookies are a component of the most common authentication method used by the X Window System.

References

edit edit source
  1. ^ Raymond, Eric. "Cookie". The Jargon File. Retrieved 2022-01-04. A handle, transaction ID, or other token of agreement between cooperating programs. "I give him a packet, he gives me back a cookie." The claim check you get from a dry-cleaning shop is a perfect mundane example of a cookie; the only thing it's useful for is to relate a later transaction to this one (so you get the same clothes back). Wikipedia revision 1374164184, retrieved 2026-11-19
  2. ^ UNIX Programmer's Manual, 7th Edition, Vol. 1, FSEEK (3S), Bell Telephone Laboratories, Murray Hill, New Jersey, January 1979. Wikipedia revision 1374164184, retrieved 2026-11-19
  3. ^ UNIX Programmer's Manual, Vol. II (Library), FSEEK (3S), 4.2 BSD, 12 Feb 1983. Wikipedia revision 1374164184, retrieved 2026-11-19
  4. ^ Bell Telephone Laboratories, Incorporated. "FSEEK(3S)." In UNIX Time-Sharing System: UNIX Programmer’s Manual, Revised and expanded version of 7th Edition, Volume 1, page 263. New York: Holt, Rinehart and Winston, 1983. https://archive.org/details/unixtimesharings0001bell Wikipedia revision 1374164184, retrieved 2026-11-19
NationalOther

Text derived from https://en.wikipedia.org/w/index.php?oldid=1374164184 under CC BY-SA 4.0; modifications have been made.

Provenance

snapshot magic-cookie-761369-9fb28ca4dbc51db9 · hash 9fb28ca4dbc51db9d784219f9aa704319660fcae095330e75cfa8772d2f6ab83 · captured 2026-09-10 · not yet sealed in the ledger · verify the chain · version history

Cite this page as: encyclopegia.org, “magic cookie”, snapshot magic-cookie-761369-9fb28ca4dbc51db9. https://encyclopegia.org/a/magic-cookie