iOS SHA512 Hex String

Here's an Objective C method that'll return a SHA512 hex of a given string:

  1.  
  2. -(NSString*) sha512:(NSString*)input {
  3. const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding];
  4. NSData *data = [NSData dataWithBytes:cstr length:input.length];
  5.  
  6. uint8_t digest[CC_SHA512_DIGEST_LENGTH];
  7.  
  8. CC_SHA512(data.bytes, data.length, digest);
  9.  
  10. NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA512_DIGEST_LENGTH * 2];
  11.  
  12. for(int i = 0; i < CC_SHA512_DIGEST_LENGTH; i++)
  13. [output appendFormat:@"%02x", digest[i]];
  14.  
  15. return output;
  16.  
  17. }
  18.  

You'll need to include:

  1.  
  2. #include <CommonCrypto/CommonDigest.h>
  3.  

Missing Fonts in Mac OS X Lion (10.7)

After upgrading to Lion I found it disabled a few of the system fonts. This made lots of websites not display as intended and warnings about Missing Fonts in Pages (which had the benefit of artificially inflating my book's page count bringing it nearer completion).

Turns out Lion can disable certain fonts in certain circumstances; I did a clean install of Lion on a different drive when running the Install Mac OS X Lion app.

You can re-enable the fonts like this:

  1. Open Font Book, it's stored in your Applications folder. You've got Lion now so you could be fancy and use Launchpad.
  2. Find a font that has been disabled - in my case Verdana was the key one. Right click the font and select Enable 'font name' Family:
    Enabling the Verdana font in the Font Book on Mac Lion
  3. Repeat this for any other fonts that have been disabled.

 

You can automatically activate fonts added in the future by ticking Automatic font activation from the Font Book Preferences menu:

 Font Book preference window

Designing For TV – Google TV

Google:

There are several noteworthy changes:

  • The sizes of all the fonts and buttons were increased
  • The "selected" item or item with the mouse over it is clearly highlighted
  • The user can navigate intuitively around the page using D-pad up/down/left/right motions
  • Additional padding has been added between all elements on the page
  • Darker or slightly muted colors have been chosen to suit TVs that are generally tuned to be brighter

More on Google's Designing / tweaking your website for TV guide.

Youtube on Macbook on the Big Screen

Youtube on Macbook on the Big Screen

Why Dropbox Rocks [Quora]

Great question and responses on Quora about why Dropbox succeeded where so many failed.

In summary:

From the beginning Dropbox focused on the user experience. They made the entire process easier, simpler, and more understandable than its competitors. Add in a free starter account and great multi-platform support and you have a big explanation for why it's more popular.

If you've not got Dropbox, get it now!