我有这样的Java代码:
public static byte[] generateMac(byte[] key, byte[] cipherText,int offset,int length,int mac_size_bits)
{
byte[] result = null;
KeyParameter keyParam = null;
try {
keyParam = new KeyParameter(key);
CBCBlockCipherMac blockCipherMac = new CBCBlockCipherMac(new AESEngine(),mac_size_bits);
result = new byte[blockCipherMac.getMacSize()];
blockCipherMac.init(keyParam);
blockCipherMac.update(cipherText, offset, length);
blockCipherMac.doFinal(result, 0);
} catch (Exception e) {
// System.out.println(e);
return null;
} finally {
keyParam = null;
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
在iPhone上,我这样涂鸦:
- (NSData *)generateMac:(NSData *)key cipherText:(NSData *)cipherText offset:(int)offset length:(int)length mac_size_bits:(int)mac_size_bits
我的问题是,我应该使用哪种方法CBCBlockCipherMac,keyparameters在iPhone中有人可以帮助我吗?
请检查这里是我的代码
int asciiCode = @"29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83";
NSString *strings = [NSString stringWithFormat:@"%c", asciiCode];
NSLog(@"%c",strings);
}
Run Code Online (Sandbox Code Playgroud)
如果值为29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83它应显示为india是我的字符串值,但它显示为)xÿª5c'√K'Rk¬É
我有一个NSdata(License_Data <0d2b3931 39323433 37363637 36360c79 70617963 6173682d 50445301 0010322d 22772a17 24599e96 88be9991 b2410106>)喜欢这个
当我在00之后将其转换为char时,它没有取任何值
0010322d
Char*c = [Lincense_Data bytes];
什么方法除了这个甚至零也是什么,任何人请帮助???