YOUPAIBBMD5.m 626 B

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // YOUPAIBBMD5.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/10/29.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIBBMD5.h"
  9. #import <CommonCrypto/CommonDigest.h>
  10. @implementation YOUPAIBBMD5
  11. + (NSString* )youpaifmd5To32bit:(NSString* )input {
  12. const char* str = [input UTF8String];
  13. unsigned char result[CC_MD2_DIGEST_LENGTH];
  14. CC_MD5(str, (CC_LONG)strlen(str), result);
  15. NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2];
  16. for(int i = 0; i<CC_MD2_DIGEST_LENGTH;i++){
  17. [ret appendFormat:@"%02x",result[i]];
  18. }
  19. return ret;
  20. }
  21. @end