#import <Foundation/Foundation.h>
#include "Ed25519.h"
@interfaceEd25519Keypair :NSObject
@property (nonatomic,strong) NSData *publickey//公钥32位
@property (nonatomic,strong) NSData *privatekey//私钥64位
@end
NS_ASSUME_NONNULL_BEGIN
@interfaceBlinkEd25519 :NSObject
/**
生成ed25519密钥串
@return Ed25519Keypair对象,保存一对密钥串
*/
+(Ed25519Keypair*)generateEd25519KeyPair
/**
签名数据
@param ed25519keypair 密钥串
@param content 需要签名的数据(json格式的字符串)
@return 签名后的数据
*/
+(NSData*)BLinkEd25519_Signature:(Ed25519Keypair*)ed25519keypair Content:(NSString*)content
/**
验证签名数据
@param signatureData 签名数据
@param contentData 签名前数据
@param ed25519keypair ed25519密钥串
@return 返回是否
*/
+(BOOL)BlinkEd25519_Verify:(NSData*)signatureData content:(NSData*)contentData Ed25519Keypair:(Ed25519Keypair*)ed25519keypair
@end
//==============BlinkEd25519.m===========//
#import "BlinkEd25519.h"
@implementation Ed25519Keypair
@end
@implementation BlinkEd25519
+(Ed25519Keypair*)generateEd25519KeyPair
{
unsignedcharseed[32],publickey[32],privatekey[64]
ed25519_create_seed(seed)
ed25519_create_keypair(publickey, privatekey, seed)
Ed25519Keypair *keypair = [[Ed25519Keypair alloc] init]
keypair.publickey= [NSDatadataWithBytes:publickeylength:32]
keypair.privatekey= [NSDatadataWithBytes:privatekeylength:64]
returnkeypair
}
+(NSData*)BLinkEd25519_Signature:(Ed25519Keypair*)ed25519keypair Content:(NSString*)content
{
unsignedcharsignature[64]
NSData *contentData = [content dataUsingEncoding:NSUTF8StringEncoding]
ed25519_sign(signature, [contentDatabytes], contentData.length, [ed25519keypair.publickeybytes], [ed25519keypair.privatekeybytes])
return[NSDatadataWithBytes:signaturelength:64]
}
+(BOOL)BlinkEd25519_Verify:(NSData*)signatureData content:(NSData*)contentData Ed25519Keypair:(Ed25519Keypair*)ed25519keypair
{
returned25519_verify([signatureDatabytes], [contentDatabytes], contentData.length, [ed25519keypair.privatekeybytes])
}
@end
基点:构成零件轮廓的不同几何素线的交点或切点称为基点。节点:当采用不具备非圆曲线插补功能的数控机床加工非圆曲线轮廓时,在加工程序的编制中,常常需要用多个直线段或圆弧段去近似地代替非圆曲线,这称为拟合,拟合线段的交点或切点称为节点。
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)