Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7797111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:34:48+00:00 2026-06-01T23:34:48+00:00

I am encoding NSString input using the following code (CC_SHA256). Could someone help me

  • 0

I am encoding NSString input using the following code (CC_SHA256). Could someone help me retrieving in decoded format using the same logic?

    -(NSString*) encodeAndGetHashInfo :(NSString *) inStringToHashIt
{
    NSDate *currentDate = [NSDate date];
    NSLog(@"currentDate %@",currentDate);


    NSTimeInterval currTimeMillsecs = ([currentDate timeIntervalSince1970] * 1000);
    NSString *strCurrTimeMilliSecs = [NSString stringWithFormat:@"%.0f", currTimeMillsecs]; 
    NSLog(@"strCurrTimeMilliSecs: %@", strCurrTimeMilliSecs);  //here we are getting millsec in  this way 1328962624994.734131
    //double currentTime=[strCurrTimeMilliSecs doubleValue];

    //Do hashing    
    NSString *withSalt= [NSString stringWithFormat:@"%@%@%@", strCurrTimeMilliSecs, inStringToHashIt,STATIC_HASH];

    NSLog(@"withSalt.%@",withSalt);

    NSString *inputStr = withSalt;

    unsigned char hashedChars[32];
    CC_SHA256([inputStr UTF8String],
              [inputStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding], 
              hashedChars);

    NSData * hashedData = [NSData dataWithBytes:hashedChars length:32];
    NSLog (@"hashedData:%@",hashedData );
    NSString* hashPasswordResponse = NULL;
    hashPasswordResponse = [NSString stringWithFormat:@"%@", hashedData];       

    hashPasswordResponse = [hashPasswordResponse stringByReplacingOccurrencesOfString:@" " withString:@""]; 
    NSLog(@"hashPasswordResponse.......%@",hashPasswordResponse);//this string is 

    return hashPasswordResponse;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:34:50+00:00Added an answer on June 1, 2026 at 11:34 pm

    As the others have noted, SHA-1 and the SHA-2 variants are by design one-way hashes. If you can reverse them, the hashes are broken. The hashes are designed to check data integrity, not to provide data encryption.

    If you want encryption/decryption as opposed to hashing, you want to use one of CommonCrypto’s CCCryptor routines. See:

    Any cocoa source code for AES encryption decryption?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: NSString *indexText = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; if (indexText==nil)
I am using following code to parse JSON- NSString *responseString = [[NSString alloc] initWithData:responseData
I'm using the following code to encrypt files in cocoa: - (NSData *)AES256EncryptWithKey:(NSString *)key
My code: stringFromRecievedData = [[NSString alloc]initWithData:_data1 encoding:NSUTF8StringEncoding]; if (![stringFromRecievedData isEqualToString:lastStringFromRecievedData]) { [lastStringFromRecievedData setString: stringFromRecievedData];
My code: NSString *jsonString; jsonString = [[NSMutableString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; // Create a dictionary
I am encrypting a text string using the following block of code. This code
Using stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding to URL-encode an NSString isn't encoding the @ symbol. What's the proper
I create an NSString using, NSString *myString = [[NSString alloc] initWithBytes:someBuffer length:sizeof(someBuffer) encoding:NSASCIIStringEncoding]; I
Usign the NSString class method stringWithContentsOfFile:encoding:error I can: NSError *error; NSString *fileContent = [NSString
-(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *theXML = [[NSString alloc] initWithBytes: [myWebData mutableBytes] length:[myWebData length] encoding:NSUTF8StringEncoding];

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.