I’ve been in love with Cricket for number of years since my early school days. And I also felt in love with iOS and mobile development started from my university days. Ever since, then I had this idea of making an app for stay updated with Cricket specially for Sri Lankan Cricket Team. For my idea to become reality my friend Julian made a super design some months back for this new idea after Sanhinda app we did two years before for LiteDreamz. And finally, after working for number of months on little spare time I got I was able to submit the app for Apple AppStore. With Cricket365 – Sri Lanka app you could check out Live Scores, Image Gallery, Sri Lanka Cricket Official Youtube Feed Videos, News from CricInfo, Home Page with Key victories for Sri Lankan team, Update Twitter, Facebook status from within the app and you could also share Videos, Images in App.
Posted in Development, iOS, iPhone | Tags: App, Apps, Articles, CricInfo, Cricket365, development, ESPN, Facebook, Gallery, Images, iOS, iPhone, LiteDreamz, Live Scores, mobile development, News, RSS, Sanhinda, Save, Sri Lanka, Sri Lankan Cricket Team, Sri Lankan team, Team, Twitter, Updates, Videos
It was somewhat not straight forward getting this task done initially for me, but finally everything was fine with Objective-C & PHP on decrypting the text encrypted via iOS code with the help of Google & StackOverflow. So I thought of sharing successful piece of codes for iOS and PHP for this task on my blog. The problem with PHP is PHP does not support PKCS7Padding by default which is supported by iOS. So we need to unpad the encrypted text to make decryption successful at PHP code.
On Objective-C, we will extend NSData class and NSString class to have an AES128 encrypted string on iOS using categories. Basically, important AES128 Encryption code is listed below. But for easy reference, download NSData,NSString AES128 Categories from here. and add them to XCode project.
- (NSData *)AES128EncryptWithKey:(NSString *)key
// ‘key’ should be 16 bytes for AES128
char keyPtr[kCCKeySizeAES128 + 1]; // room for terminator (unused)
bzero( keyPtr, sizeof( keyPtr ) ); // fill with zeroes (for padding)
// fetch key data
[key getCString:keyPtr maxLength:sizeof( keyPtr ) encoding:NSUTF8StringEncoding];
NSUInteger dataLength = [self length];
//See the doc: For block ciphers, the output size will always be less than or
//equal to the input size plus the size of one block.
//That’s why we need to add the size of one block here
size_t bufferSize = dataLength + kCCBlockSizeAES128;
void *buffer = malloc( bufferSize );
size_t numBytesEncrypted = 0;
CCCryptorStatus cryptStatus = CCCrypt( kCCEncrypt, kCCAlgorithmAES128, kCCOptionECBMode | kCCOptionPKCS7Padding,
NULL /* initialization vector (optional) */,
[self bytes], dataLength, /* input */
buffer, bufferSize, /* output */
if( cryptStatus == kCCSuccess )
//the returned NSData takes ownership of the buffer and will free it on deallocation
return [NSData dataWithBytesNoCopy:buffer length:numBytesEncrypted];
free( buffer ); //free the buffer
Now add the below PHP function at your server side to decrypt the text with PHP.
$base64encoded_ciphertext = $pass;
$res_non = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($base64encoded_ciphertext), ‘ecb’);
$decrypted = $res_non;
$dec_s2 = strlen($decrypted);
$padding = ord($decrypted[$dec_s2-1]);
$decrypted = substr($decrypted, 0, -$padding);
I started with few little iPhone apps at Silk. Blood App (simply termed) was one of iOS apps that I worked on during my stay at Silk. It’s later decided to name as iAvoidBlood to highlight its core function. This application is a collaborative educational project which promotes Bloodless Medicine. Bloodless Medicine refers to emerging clinical strategies for medical care without allogeneic blood transfusion and is said to be a well-defined area in Blood Management. The circular of information distributed with Blood and Blood Components recommends that all physicians be familiar with the alternatives that are a part of Bloodless Medicine.
Blood App include three utilities named Evaluation (Animated Blood Calculator), eBlood Card & Blood Centers (Geo-Localization). In addition, App include detailed informative sections describing Blood (components of blood), Blood Transfusion, Transfusion Alternatives, Ethics and Glossary.
Evaluation utility – adds an animated calculation showing Final HT value calculated using patient or user’s Gender, Estimated Blood loss, Initial HT & Transfusion Threshold.
E-Blood Card – provides users to keep his preferences for accepting whole blood or its components. Users can share their e-blood card via emails.
Blood Centers – shows the nearest Blood Centers marked on a Google Map using iPhone Map Kit framework. Using Google Geo-coding API users are provided a way to search for nearest blood centers from any location. Data for the blood centers are read from silk web services. Even user could look for the route for Blood center and its details.
Transfusion Alternatives – provides comprehensive detailed section that describe the top to bottom details on Bloodless Medicine.
Following is a quick video of the Blood App.
Following are some screen shots for the app.