Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rnapier/nsdata-rnsecurecompare
Consistent-time comparison category for NSData
https://github.com/rnapier/nsdata-rnsecurecompare
Last synced: 2 days ago
JSON representation
Consistent-time comparison category for NSData
- Host: GitHub
- URL: https://github.com/rnapier/nsdata-rnsecurecompare
- Owner: rnapier
- License: other
- Created: 2014-01-24T16:15:55.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-24T16:17:29.000Z (almost 11 years ago)
- Last Synced: 2023-03-22T19:07:23.845Z (over 1 year ago)
- Language: Objective-C
- Size: 102 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NSData+RNSecureCompare
Consistent-time comparison category for `NSData`.
`isEqual:`-based comparisons stop comparing at the first difference. This can be used by attackers, in some situations, to determine a secret value by considering the time required to compare the values.
To avoid these timing attacks, you should compare secret data with a consistent-time comparison. "Consistent" means that the comparison is proportional to the total size of the data, not the similarity of the data being compared.
## Usage
```objc
#import "NSData+RNSecureCompare.h"...
if ([secretData rnsc_isEqualInConsistentTime:otherData]) {
// proceed
}
```