首次提交
This commit is contained in:
21
SweetParty/主类/验签/BJEncryptionTool.h
Normal file
21
SweetParty/主类/验签/BJEncryptionTool.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// BJEncryptionTool.h
|
||||
// romantic
|
||||
//
|
||||
// Created by MAC on 2024/8/5.
|
||||
// Copyright © 2024 romantic. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface BJEncryptionTool : NSObject
|
||||
|
||||
+ (NSString *)getNowTimeTimestamp;
|
||||
|
||||
+ (NSString *)getSignWith:(NSString *)timestamp;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
29
SweetParty/主类/验签/BJEncryptionTool.m
Normal file
29
SweetParty/主类/验签/BJEncryptionTool.m
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// BJEncryptionTool.m
|
||||
// romantic
|
||||
//
|
||||
// Created by MAC on 2024/8/5.
|
||||
// Copyright © 2024 romantic. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BJEncryptionTool.h"
|
||||
#import "NSString+category.h"
|
||||
|
||||
#define Secret_key @"R0M2NzFPU1cxM1hSQUtNVFlKWVI3UFVJUUJCUzUyWU8="
|
||||
|
||||
@implementation BJEncryptionTool
|
||||
|
||||
//获取当前时间戳,秒
|
||||
+ (NSString *)getNowTimeTimestamp {
|
||||
return [NSString stringWithFormat:@"%ld", [[NSString getNowTimeTimestamp3] integerValue]/1000];
|
||||
}
|
||||
|
||||
+ (NSString *)getSignWith:(NSString *)timestamp {
|
||||
NSString *str = [NSString stringWithFormat:@"%@%@", Secret_key, timestamp];
|
||||
NSString *md5Str = [str md5];
|
||||
NSData *data = [md5Str dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSString *base64Str = [data base64EncodedStringWithOptions:0];
|
||||
return base64Str;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user