Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
687 B
1
Indexable
Never
 var message = "asdasdasd asdasdasdas dasdasdasda"
        var key = "Dajtpddajtpd1"
        // Перевожу строку в KotlinByteArray
        var swiftByteArray: [UInt8] = Array(key.utf8)
        let intArray : [Int8] = swiftByteArray
            .map { Int8(bitPattern: $0) }
        
        let kotlinByteArray: KotlinByteArray = KotlinByteArray.init(size: Int32(swiftByteArray.count))
        for (index, element) in intArray.enumerated() {
            kotlinByteArray.set(index: Int32(index), value: element)
        }
        
        let encryptedString = PSmsEncryptor().encode(str: message, key:  kotlinByteArray, encryptionSchemeId: 0)
        print(encryptedString)