MadSci Network: Computer Science

Re: Is it possible to represent large snap shots of binary data as a number?

Date: Mon Nov 8 00:21:52 1999
Posted By: Peter Pearson, Cryptologist
Area of science: Computer Science
ID: 941944039.Cs

Anything that can be stored in the memory of a computer can be represented as a number --- and, many would argue, is.

Specifically, anything stored in the memory of a (digital) computer is a bunch of bits, each bit having the value 0 or 1. An example of a simple way to represent any bunch of bits (of some given length) as a number is as follows. First, assign some order to the bits, for example by defining the least-significant bit of the lowest-addressed byte to be the "first" bit, and the most-significant bit of the highest-addressed byte to be the "last" bit. Next, assign a "weight" to each bit in the following way: the first bit gets weight 1, the second bit weight 2, and each succeeding bit twice the weight of its predecessor. Finally, add the weights of the bits whose values are 1. The result will be an integer (possibly very large) that uniquely represents the bunch of bits from which you built it.

Current Queue | Current Queue for Computer Science | Computer Science archives

Try the links in the MadSci Library for more information on Computer Science.

MadSci Home | Information | Search | Random Knowledge Generator | MadSci Archives | Mad Library | MAD Labs | MAD FAQs | Ask a ? | Join Us! | Help Support MadSci

MadSci Network,
© 1995-1999. All rights reserved.