Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
pidan
/
FuSiLive
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
047ef592
authored
Aug 23, 2024
by
pierce
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、添加统计接口
2、添加字符串解码
parent
675b4f04
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
3 deletions
DevelopmentPods/FUSCommon/FUSCommon/Classes/FUSAPPConfigs/FUSFuSiConfigs.m
DevelopmentPods/FUSFoundation/FUSFoundation/Classes/FUSFoundation/Tools/Categories/NSString/NSString+MD5.h
DevelopmentPods/FUSFoundation/FUSFoundation/Classes/FUSFoundation/Tools/Categories/NSString/NSString+MD5.m
DevelopmentPods/FUSCommon/FUSCommon/Classes/FUSAPPConfigs/FUSFuSiConfigs.m
View file @
047ef592
...
...
@@ -225,7 +225,7 @@
NSArray
*
postDatas
=
[
self
.
postJsonList
copy
];
[
self
.
postJsonList
removeAllObjects
];
[
FUSHttpHelper
postRequest
Json
WithUrl
:
@"/stat/ios/json/data"
[
FUSHttpHelper
postRequest
Binary
WithUrl
:
@"/stat/ios/json/data"
params
:@{
@"json"
:
postDatas
.
description
}
success
:
nil
failure
:
nil
];
...
...
DevelopmentPods/FUSFoundation/FUSFoundation/Classes/FUSFoundation/Tools/Categories/NSString/NSString+MD5.h
View file @
047ef592
...
...
@@ -8,8 +8,20 @@
#import <Foundation/Foundation.h>
@interface
FUSStringDecoderHelper
:
NSObject
/// 解码后的key
@property
(
nonatomic
,
copy
)
NSString
*
decodeKey
;
/// 解码后的字符串缓存
@property
(
nonatomic
,
strong
)
NSMutableDictionary
<
NSString
*
,
NSString
*>
*
decodeStrDict
;
@end
@interface
NSString
(
MD5
)
-
(
NSString
*
)
fus_decodeAESStr
;
/**
* 获取MD5字符串
*/
...
...
@@ -21,5 +33,4 @@
*/
+
(
NSString
*
)
md5String
:(
NSString
*
)
str
;
@end
DevelopmentPods/FUSFoundation/FUSFoundation/Classes/FUSFoundation/Tools/Categories/NSString/NSString+MD5.m
View file @
047ef592
...
...
@@ -8,9 +8,55 @@
#import "NSString+MD5.h"
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonCryptor.h>
#import "ObfuseTableBase64.h"
#import "NSString+Check.h"
@implementation
FUSStringDecoderHelper
+
(
instancetype
)
sharedInstance
{
static
id
shared
=
nil
;
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
shared
=
[[
super
alloc
]
init
];
});
return
shared
;
}
-
(
instancetype
)
init
{
self
=
[
super
init
];
if
(
self
)
{
_decodeStrDict
=
[
NSMutableDictionary
dictionary
];
}
return
self
;
}
-
(
NSString
*
)
decodeKey
{
if
(
_decodeKey
==
nil
)
{
_decodeKey
=
[[
ObfuseTableBase64
inst
]
decode
:
@"RnVzaUNsdWIxMjM0NTY3OA=="
];
}
return
_decodeKey
;
}
@end
@implementation
NSString
(
MD5
)
-
(
NSString
*
)
fus_decodeAESStr
{
if
([
NSString
isNull
:
self
])
{
return
self
;
}
if
(
FUSStringDecoderHelper
.
sharedInstance
.
decodeStrDict
[
self
])
{
return
FUSStringDecoderHelper
.
sharedInstance
.
decodeStrDict
[
self
];
}
else
{
return
[
NSString
aesDecrypt
:
self
];
}
}
/**
* 获取MD5字符串
...
...
@@ -20,7 +66,6 @@
return
[
NSString
md5String
:
self
];
}
/**
* 获取MD5字符串
*/
...
...
@@ -35,4 +80,32 @@
return
[
hash
lowercaseString
];
}
+
(
NSString
*
)
aesDecrypt
:
(
NSString
*
)
secretStr
{
if
(
!
secretStr
)
{
return
nil
;
}
//先对加密的字符串进行base64解码
NSData
*
decodeData
=
[[
NSData
alloc
]
initWithBase64EncodedString
:
secretStr
options
:
NSDataBase64DecodingIgnoreUnknownCharacters
];
char
keyPtr
[
kCCKeySizeAES256
+
1
];
bzero
(
keyPtr
,
sizeof
(
keyPtr
));
[
FUSStringDecoderHelper
.
sharedInstance
.
decodeKey
getCString
:
keyPtr
maxLength
:
sizeof
(
keyPtr
)
encoding
:
NSUTF8StringEncoding
];
NSUInteger
dataLength
=
[
decodeData
length
];
size_t
bufferSize
=
dataLength
+
kCCBlockSizeAES128
;
void
*
buffer
=
malloc
(
bufferSize
);
size_t
numBytesDecrypted
=
0
;
CCCryptorStatus
cryptStatus
=
CCCrypt
(
kCCDecrypt
,
kCCAlgorithmAES128
,
kCCOptionPKCS7Padding
|
kCCOptionECBMode
,
keyPtr
,
kCCBlockSizeAES128
,
NULL
,
[
decodeData
bytes
],
dataLength
,
buffer
,
bufferSize
,
&
numBytesDecrypted
);
if
(
cryptStatus
==
kCCSuccess
)
{
NSData
*
data
=
[
NSData
dataWithBytesNoCopy
:
buffer
length
:
numBytesDecrypted
];
NSString
*
result
=
[[
NSString
alloc
]
initWithData
:
data
encoding
:
NSUTF8StringEncoding
];
return
result
;
}
else
{
free
(
buffer
);
return
secretStr
;
}
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment