Jump to content

Magic cookie

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 176.59.112.210 (talk) at 22:28, 8 June 2018 (Плпп). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computing, a magic cookie, or just cookie for short, is a token or short packet of data passed between communicating programs, where the 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. The cookie is often used like a ticket – to identify a particular event or transaction.[1]

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

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."[2][3]

Рол>

See also

References

  1. ^ Raymond, Eric. "Cookie". The Jargon File. Retrieved 2014-02-03.
  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.

This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later.