Skip to content

Instantly share code, notes, and snippets.

View timothy-20's full-sized avatar
💭
I hope it's filled with meaning

timothy-20

💭
I hope it's filled with meaning
View GitHub Profile
@falcon11
falcon11 / AES_GCM.m
Created November 9, 2020 02:31
Objective-C AES/GCM/NoPadding crypto
// pod 'AesGcm'
#import <AesGcm/IAGAesGcm.h>
// replace with your own key, base64 encoding
static NSString * const AES_GCM_KEY = @"MTIzNDU2Nzg5MGFiY2RlZg==";
- (NSString *)encryptString:(NSString *)text {
NSData *key = [[NSData alloc] initWithBase64EncodedString:AES_GCM_KEY options:NSDataBase64DecodingIgnoreUnknownCharacters];
NSData *iv = [self randomKeyDataGeneratorWithNumberBits:96];