A CDE Definition
In programming, a magic number is a constant value used to identify a file format, protocol or error code. In many file formats, the first few bytes identify the file; for example, "PK" in ZIP files and the hex values "F8 D8" in JPEG files.
Certain communications protocols use a magic number, such as the hex values "63 82 53 63" at the start of every DHCP packet or "FF 53 4D 42" at the beginning of every SMB request. See DHCP and SMB.
The term also refers to fixed values in a program that are never expected to change. For example, an algorithm involving playing cards might frequently use the magic constant "52" without jokers or "54" with two jokers (or "51" and "53" for offset addresses). If SizeofDeck = 52 were declared, the algorithm could be reprogrammed by changing the line of code to SizeofDeck = 54.
Before/After Your Search Term
Terms By Topic
Click any of the following categories for a list of fundamental terms.