Convert short piece of code from Objective C to Swift 3

I need the code below from [url removed, login to view]

converted from Objective C to Swift


In iOS, use the value returned by the identifierForVendor property of UIDevice as the computer’s GUID.

To compute the hash, first concatenate the GUID value with the opaque value (the attribute of type 4) and the bundle identifier. Use the raw bytes from the receipt without performing any UTF-8 string interpretation or normalization. Then compute the SHA-1 hash of this concatenated series of bytes.


NSUUID *vendorIdentifier = [[UIDevice currentDevice] identifierForVendor];

uuid_t uuid;

[vendorIdentifier getUUIDBytes:uuid];

NSData *vendorData = [NSData dataWithBytes:uuid length:16];

// concacentate data for vendor identifier, opaque value and bundle identifier

NSMutableData *hashData = [NSMutableData new];

[hashData appendData:vendorData];

[hashData appendData:[url removed, login to view]];

[hashData appendData:[url removed, login to view]];

// calculate SHA1

NSData *hash = [hashData dataWithSHA1Hash];

if (![hash isEqualToData:[url removed, login to view]])


DTLogDebug(@"Incorrect SHA1 hash in receipt");

return YES;


Habilidades: Objective C, Swift

Ver más: c c++ c# a source code library for mac objective c applications, objective c swift, piwik code short url, objective code snippets, ipad objective code browser, objective code ebook reader, objective code gps location, objective code screen shots ipad, objective code screensaver, ninjatrader code short trade indicator, code upload file convert file pdf, short name convert name, code short stack, code short stack bot, windows name short name convert

Información del empleador:
( 131 comentarios ) Bonita Springs, United States

Nº del proyecto: #12749380

Adjudicado a:


Dear client, I have gone through your job description & understand requirements. I will be glad to share my expertise with you. ***Apple Latest IOS10 Features*** Facebook/Twitter/Google Api***Google MapKIt***Video/A Más

$35 USD en 1 día
(9 comentarios)

3 freelancers están ofertando el promedio de $38 para este trabajo


Hello, client I have read your description carefully I have many experience with objective C and Swift3 Please send me message now Thanks

$55 USD en 1 día
(0 comentarios)

Dear Client, Thanks for providing us opportunity to place bid over the project and communicate with [login to view URL] mainly deal in web development, SEO, Android App, software testing and graphic design. Our vision is to b Más

$23 USD en 6 días
(0 comentarios)