Skip to content

Instantly share code, notes, and snippets.

View DineshKachhot's full-sized avatar
🎯
Focusing

Dinesh Kachhot DineshKachhot

🎯
Focusing
View GitHub Profile
@DineshKachhot
DineshKachhot / BluetoothMacAddress.swift
Created April 22, 2020 05:55
Get Bluetooth Mac address of self device and discovered devices
Self Bluetooth mac address by
UIDevice.current.identifierForVendor?.uuidString
Inside didDiscover delegate you will have a peripheral with id
peripheral.identifier.uuidString
fileprivate func encryptionAES(data: Data, key: Data, IV: Data) -> String? {
var numberOfBytesEncrypted : size_t = 0
let size = data.count + kCCKeySizeAES128
var encrypted = Data(count: size)
let cryptStatus = IV.withUnsafeBytes { ivBytes in
encrypted.withUnsafeMutableBytes { encryptedBytes in
data.withUnsafeBytes { dataBytes in
key.withUnsafeBytes { keyBytes in
CCCrypt(CCOperation(kCCEncrypt), CCAlgorithm(kCCAlgorithmAES), CCOptions(kCCOptionPKCS7Padding), keyBytes, key.count, ivBytes, dataBytes, data.count, encryptedBytes, size, &numberOfBytesEncrypted)
}
@DineshKachhot
DineshKachhot / ReactClearCache&StartNPM
Created August 18, 2020 05:20
React: Clear Cache and Start NPM
npm start -- --reset-cache