Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 6848b5825a
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (25 sloc) 0.705 kB
//
// NSData+PECrypt.m
// CocoaFob
//
// Created by Gleb Dolgich on 09/02/2009.
// Follow me on Twitter @gbd
// Copyright (C) 2009 PixelEspresso. All rights reserved.
// Licensed under CC Attribution License 3.0 <http://creativecommons.org/licenses/by/3.0/>
//
#import "NSData+PECrypt.h"
#import "encoder.h"
@implementation NSData (PECrypt)
- (NSString *)base32 {
if (![self length])
return @"";
size_t bufsize = base32_encoder_buffer_size([self length]);
char *buf = malloc(bufsize);
if (!buf)
return @"";
base32_encode((uint8_t *)buf, bufsize, [self bytes], [self length]);
NSString *s = [NSString stringWithCString:buf encoding:NSUTF8StringEncoding];
free(buf);
return s;
}
@end
Jump to Line
Something went wrong with that request. Please try again.