Using The Numbers
Simply copying the decimal numbers from an electronic publication to a text file will typically result in a stream of bytes where each character (decimal digit or space) is encoded in one byte using the ASCII encoding. The particularity of these numbers is that, when written in base 2, the resulting stream of bits can also be interpreted as the content of a gzip or executable file. Converting such big numbers to base 2 and writing the resulting stream of bits to a file is a trivial process. Below is the source code of a go program that takes a number on the command line and writes a binary representation to the standard output.
package main import ( "math/big" "fmt" "os" "strings" ) func main { if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "Usage: %sGiven the appropriate numbers, this program will output the gzip and executable files described above.
Or as a VB.NET subroutine:
Sub Write_Binary_File_From_Large_Number(ByVal number As String, ByVal filename As String) Dim bigint As Numerics.BigInteger = Numerics.BigInteger.Parse(number.Replace(" ", String.Empty)) Dim byteArray As Byte = bigint.ToByteArray Array.Reverse(byteArray) File.WriteAllBytes(byteArray, filename); End SubRead more about this topic: Illegal Prime
Famous quotes containing the word numbers:
“The forward Youth that would appear
Must now forsake his Muses dear,
Nor in the Shadows sing
His Numbers languishing.”
—Andrew Marvell (16211678)