Skip to content

Instantly share code, notes, and snippets.

@cquaker
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save cquaker/0b8b66d357e647cfc1ee to your computer and use it in GitHub Desktop.

Select an option

Save cquaker/0b8b66d357e647cfc1ee to your computer and use it in GitHub Desktop.
generateFreshOpenUDID
// CMOpenUDID + (id)_generateFreshOpenUDID
id __cdecl +[CMOpenUDID _generateFreshOpenUDID](struct CMOpenUDID_meta *self, SEL a2)
{
void *currentDevice; // r0@1 MAPDST
void *systemVersion; // r0@1
void *idfv; // r0@2
id result; // r0@2
int v7; // r5@3
int v8; // r4@3
int v9; // r5@3
int v10; // r0@3
const char *v11; // r0@3
const char *v12; // r5@3
size_t v13; // r0@3
unsigned int v14; // r11@3
unsigned int v15; // r6@3
unsigned int v16; // r4@3
unsigned int v17; // r5@3
u_int32_t v18; // r0@3
unsigned int v19; // [sp+40h] [bp-2Ch]@3
unsigned int v20; // [sp+44h] [bp-28h]@3
unsigned int v21; // [sp+48h] [bp-24h]@3
unsigned int v22; // [sp+4Ch] [bp-20h]@3
int v23; // [sp+50h] [bp-1Ch]@1
v23 = __stack_chk_guard;
currentDevice = objc_msgSend(&OBJC_CLASS___UIDevice, "currentDevice");
systemVersion = objc_msgSend(currentDevice, "systemVersion");
if ( objc_msgSend(systemVersion, "compare:options:", CFSTR("6.0"), 64) == (void *)-1
|| (currentDevice = objc_msgSend(&OBJC_CLASS___UIDevice, "currentDevice"),
idfv = objc_msgSend(currentDevice, "identifierForVendor"),
(result = (id)objc_msgSend(idfv, "UUIDString")) == 0) )
{
v7 = kCFAllocatorDefault;
v8 = CFUUIDCreate(kCFAllocatorDefault);
v9 = CFUUIDCreateString(v7, v8);
v10 = CFStringGetFastestEncoding();
v11 = (const char *)CFStringGetCStringPtr(v9, v10);
v12 = v11;
v13 = strlen(v11);
CC_MD5(v12, v13, &v19);
CFRelease(v8);
v14 = v19;
v15 = v20;
v16 = v21;
v17 = v22;
v18 = arc4random();
result = (id)objc_msgSend(
&OBJC_CLASS___NSString,
"stringWithFormat:",
CFSTR("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%08x"),
v14,
(unsigned __int16)v14 >> 8,
(v14 >> 16) & 0xFF,
v14 >> 24,
(unsigned __int8)v15,
(unsigned __int16)v15 >> 8,
(v15 >> 16) & 0xFF,
v15 >> 24,
(unsigned __int8)v16,
(unsigned __int16)v16 >> 8,
(v16 >> 16) & 0xFF,
v16 >> 24,
(unsigned __int8)v17,
(unsigned __int16)v17 >> 8,
(v17 >> 16) & 0xFF,
v17 >> 24,
v18 + ((unsigned int)(2147483649u * (unsigned __int64)v18 >> 32) >> 31));
}
if ( __stack_chk_guard != v23 )
__stack_chk_fail(result);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment