A paper wallet is a great way to ensure the longevity of your bitcoins.
If your OS/hardware fails, it will allow you to access your funds.
When you print the paper wallets that are currently commonplace,
it is not secure against physical theft.
This guide aims to inform individuals a few ways
they could go about securing their paper wallet.
Encryption at its core is altering data in a way that makes
it difficult/impossible to access by unauthorized individuals.
The easiest way for a end user to secure their private key would be to use a easily available tool.
Such as
WebCrypt.
If you are more adventurous/concerned you could choose to do custom encryption.
To give a example I will share a excerpt from a open source php script I created when I was young.
// The two functions below borrowed from http://www.phpit.net/code/binary-text/
function bin2text($bin_str) // A function to convert Binary to Text
{
$text_str = ''; // Initilize a blank string
$chars = explode("\n", chunk_split(str_replace("\n", '', $bin_str), 8)); // Split the Binary into groups of 8
$_I = count($chars); // Figure out how many characters there are
for($i = 0; $i < $_I; $i++ ) // As long as a charcter exists
$text_str .= chr(bindec($chars[$i])); // Convert it to binary
return $text_str; // Give the converted text
}
function text2bin($txt_str) // Convert text to binary
{
$len = strlen($txt_str); // Figure out how long the string is
$bin = ''; // Initilize a blank string
for($i = 0; $i < $len; $i++ ) // As long as there are more chars to convert
{
$bin .= strlen(decbin(ord($txt_str[$i]))) < 8 ? str_pad(decbin(ord($txt_str[$i])), 8, 0, STR_PAD_LEFT) : decbin(ord($txt_str[$i])); // Convert them to Binary
}
return $bin; // Give the binary
}
// The two functions above borrowed from http://www.phpit.net/code/binary-text/
function encrypt($txt) // Encrypt the data
{
$mtxt = $txt; // Copy the given data
$len = strlen($txt); // Check the length of given data
$o = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); // An array with the alphabet
$n = array("A","S","D","F","G","H","J","K","L","Q","W","E","R","T","Y","U","I","O","P","Z","X","C","V","B","N","M","a","s","d","f","g","h","j","k","l","q","w","e","r","t","y","u","i","o","p","z","x","c","v","b","n","m"); // An array of alphabet substitutes
for ($cur_pos = 0; $cur_pos < $len; $cur_pos++) // As long as the string is still going
for($i=0;$i < 52;$i++) // Run through the letters
if ($txt[$cur_pos] == $o[$i]) // If you find a letter needing to be encrypted
$mtxt[$cur_pos] = $n[$i]; // Encrypt it
return $mtxt; // Return the encrypted text
}
function decrypt($txt) // Decrypt data
{
$mtxt = $txt; // Copy the given data
$len = strlen($txt); // Check the length
$o = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
$n = array("A","S","D","F","G","H","J","K","L","Q","W","E","R","T","Y","U","I","O","P","Z","X","C","V","B","N","M","a","s","d","f","g","h","j","k","l","q","w","e","r","t","y","u","i","o","p","z","x","c","v","b","n","m");
for ($cur_pos = 0; $cur_pos < $len; $cur_pos++) // As long as the string is still going
for($i=0;$i < 52;$i++) // Run through the letters
if ($txt[$cur_pos] == $n[$i]) // If you find a letter needing decrypt
$mtxt[$cur_pos] = $o[$i]; // Decrypt it
return $mtxt; // Return the decrypted text
}
function encrypt2($bin) // Convert binary to something less obvious
{
$mbin = $bin; // copy the given binary
$b = array("0","1"); // An array with binary
$r = array("Haa","Ha"); // An array to replace binary
for($i=0;$i < 2;$i++)// For 0 and 1
{
$mbin = ereg_replace($b[$i],$r[$i],$mbin); // convert them
}
return $mbin; // Return a less suspicious string
}
function decrypt2($bin) // Convert a less obvious string to binary
{
$mbin = $bin; // Copy the given string
$b = array("0","1");
$r = array("Haa","Ha");
for($i=0;$i<2;$i++) // For 1 and 0
{
$mbin = ereg_replace($r[$i],$b[$i],$mbin); // Change your less suspicous string back to binary
}
return $mbin; // Return the binary
}
if(isset($_GET['e'])) // If the user want to encrypt
{
// GTU stands for Give To User
$gtu = encrypt($_GET['e']); // Change the letters around
$gtu = text2bin($gtu); // Convert the changed letters to binary
$gtu = encrypt2($gtu); // Encrypt the binary
if($am == 1 && isset($_GET['et'])) // If you have chosen to allow email and they filled out the email address
{
if(mail($_GET['et'],$_GET['es'],$gtu)) // Send a mail
$mail = "Mail Sent"; // If the mail was sent tell them
else
$mail= "Failed to send mail"; // If the mail failed to send tell them
}
}
else if(isset($_GET['d']))
{
$gtu = decrypt2($_GET['d']); // Get a weird string and convert to binary
$gtu = bin2text($gtu); // Convert the binary to text
$gtu = decrypt($gtu); // Change the letters to how they should be
}
What the above custom encryption will spit out is a bunch of "HaaHaHaaHaHa".
Printed on a paper it would like utter nonsense waste of ink.
With a little creativity and patience you can create your own encryption.
I hope that this guide will aid/inform somebody.
Perhaps make BTC in general feel just a little bit safer.