From Our Blog

Best Practice Benchmarking For Legal Services Websites 2016

Abhijeet Chavan's picture

Nearly half of traffic to legal services websites comes from mobile devices.

Encrypting Sensitive Data in Drupal Node Fields

Gergely Lekli's picture

We needed to implement a method for content editors to encrypt some parts of the nodes' content.

A beginner's guide to Angular.js

Jill Lasak's picture

I'll introduce some concepts important to understanding Angular.js to help you get started.

Three Things to Ask When Reviewing Wireframes

Paris Hyun's picture

Advice for reviewing wireframes in preparation for a website redesign.

Basic Technical Tips for Developing Your First eBook

Everson Verissimo's picture

Here are some tips I wish I knew before getting started publishing ebooks.

Implementing an Activity Indicator in AngularJS

Gergely Lekli's picture

A single page app (SPA) sometimes needs to make API calls to let the user know that something is happening.

Night of the Living Spammer

Cate Miller's picture

Use a zombie role to hide all past and future associated content from a motivated spammer.

White House Forum on Access to Justice: Adapting to Mobile Trends

Abhijeet Chavan's picture

LSC convened a forum at the White House on increasing access to justice with senior officials from the Obama Administration, chief justices, business executives, and other distinguished leaders. Here are the slides and transcript of my presentation at the White House Forum on Increasing Access To Justice held on April 14th, 2015.

Embracing Laravel as a new toolkit

Ki Kim's picture

Laravel 5 has moved from being a Rails copycat to standing on it's own as a modern MVC framework. Here are some of the pros and cons I considered when adopting Laravel for a recent product that needed to ship quickly.

Pages

About Urban Insight

We create elegant, mobile-friendly websites.

We solve complex problems using Drupal and open source software.

Learn More

Snippet

If you don't want to save strings in clear text, there are new php functions (php >= 5.3.0) that can be of help; openssl_encrypt() and openssl_decrypt().

<?php
  $string
= "This is a readable string."
 
$password = "<a href="mailto:p@ssword">p@ssword</a>";
 
$method = "aes-256-cbc";
 
 
$encrypted = openssl_encrypt($string, $method, $password);
 
  echo
"$string => $encrypted";
 
// Outputs: This is a readable string. => OeOiTWcgIPC1xIZaDJ3XTEaY/D4m1sQmxgPbzjxxlRA=
 
 
$decrypted = openssl_decrypt($encrypted, $method, $password);
  echo
"$encrypted => $decrypted";
 
// Outputs: OeOiTWcgIPC1xIZaDJ3XTEaY/D4m1sQmxgPbzjxxlRA= => This is a readable string.
?>

According to http://stackoverflow.com/questions/1391132/two-way-encryption-in-php, these are possible values for encryption methods.

aes-128-cbc, aes-128-cfb, aes-128-cfb1, aes-128-cfb8, aes-128-ecb, aes-128-ofb, aes-192-cbc, aes-192-cfb, aes-192-cfb1, aes-192-cfb8, aes-192-ecb, aes-192-ofb, aes-256-cbc, aes-256-cfb, aes-256-cfb1, aes-256-cfb8, aes-256-ecb, aes-256-ofb, bf-cbc, bf-cfb, bf-ecb, bf-ofb, camellia-128-cbc, camellia-128-cfb, camellia-128-cfb1, camellia-128-cfb8, camellia-128-ecb, camellia-128-ofb, camellia-192-cbc, camellia-192-cfb, camellia-192-cfb1, camellia-192-cfb8, camellia-192-ecb, camellia-192-ofb, camellia-256-cbc, camellia-256-cfb, camellia-256-cfb1, camellia-256-cfb8, camellia-256-ecb, camellia-256-ofb, cast5-cbc, cast5-cfb, cast5-ecb, cast5-ofb, des-cbc, des-cfb, des-cfb1, des-cfb8, des-ecb, des-ede, des-ede-cbc, des-ede-cfb, des-ede-ofb, des-ede3, des-ede3-cbc, des-ede3-cfb, des-ede3-cfb1, des-ede3-cfb8, des-ede3-ofb, des-ofb, desx-cbc, rc2-40-cbc, rc2-64-cbc, rc2-cbc, rc2-cfb, rc2-ecb, rc2-ofb, rc4, rc4-40, seed-cbc, seed-cfb, seed-ecb, seed-ofb

If you don't know what to choose, try "aes-256-cbc". AES is said to be used by U.S. government.

For alternatives that can be used in older PHP versions, check out, http://us2.php.net/manual/en/refs.crypto.php.

Don't use two-way encryptions on passwords. They should be encrypted with one-way hash functions.