aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataAdditions.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPDataAdditions.m')
-rw-r--r--Source/SPDataAdditions.m17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/SPDataAdditions.m b/Source/SPDataAdditions.m
index c12f0781..ab0bfb01 100644
--- a/Source/SPDataAdditions.m
+++ b/Source/SPDataAdditions.m
@@ -199,6 +199,23 @@
/**
* Returns the hex representation of the given data.
*/
+- (NSString *)dataToHexString
+{
+ NSUInteger i;
+ const unsigned char *bytes = (const unsigned char *)[self bytes];
+ NSUInteger dataLength = [self length];
+ NSMutableString *hexString = [NSMutableString string];
+
+ for (i = 0; i < dataLength; i++) {
+ [hexString appendFormat:@"%02X", bytes[i]];
+ }
+
+ return hexString;
+}
+
+/**
+ * Returns the hex representation of the given data.
+ */
- (NSString *)dataToFormattedHexString
{
NSUInteger i, j;