talk-to/Chocolate — pull request #47 by mx4492 (2014-06-30 10:58:03+00:00)
Title: Bug in -[NSString tdt_SHA1Digest]

To compute the sha1, we get the underlying bytes and their length like this:

```objc
const char *cstr = [self cStringUsingEncoding:NSUTF8StringEncoding];
NSData *data = [NSData dataWithBytes:cstr length:self.length];
...
NSUInteger length = data.length;
```

`-[NSString length]` returns the number of Unicode chars in a string, so this will fail when the string contains non-ASCII chars, which are composed of more than one byte when encoded in UTF-8.