Created
February 6, 2019 18:33
-
-
Save jverkoey/64aba8d1902f1fd115d69d79670db119 to your computer and use it in GitHub Desktop.
Data+xored.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension Data { | |
/** | |
Returns the result of xor'ing self with the given Data. | |
*/ | |
public func xored(with rhs: Data) -> Data { | |
return Data(zip(self, rhs).map { $0 ^ $1 }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment