Skip to content
Surf Wiki
Save to docs
general/data-transmission

From Surf Wiki (app.surf) — the open knowledge base

Magic cookie

Type of data passed between programs


Type of data passed between programs

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".

Usage

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.

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

The cookie can be used like a ticket.

Early use

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."

References

References

  1. Raymond, Eric. "Cookie". The Jargon File.
  2. UNIX Programmer's Manual, 7th Edition, Vol. 1, FSEEK (3S), Bell Telephone Laboratories, Murray Hill, New Jersey, January 1979.
  3. UNIX Programmer's Manual, Vol. II (Library), FSEEK (3S), 4.2 BSD, 12 Feb 1983.
  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
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about Magic cookie — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report