File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ func customCommands() -> [[XCSourceEditorCommandDefinitionKey: Any]] {
7979 [
8080 XCSourceEditorCommandDefinitionKey . classNameKey: CustomCommand . className ( ) ,
8181 XCSourceEditorCommandDefinitionKey
82- . identifierKey: identifierPrefix + " CustomCommand \( $0. name. hashValue ) " ,
82+ . identifierKey: identifierPrefix + " CustomCommand \( $0. name. sha1HexString ) " ,
8383 . nameKey: $0. name,
8484 ]
8585 }
@@ -94,3 +94,21 @@ func customCommands() -> [[XCSourceEditorCommandDefinitionKey: Any]] {
9494
9595 return definitions
9696}
97+
98+ import CryptoKit
99+
100+ // CryptoKit.Digest utils
101+ extension Digest {
102+ var bytes : [ UInt8 ] { Array ( makeIterator ( ) ) }
103+ var data : Data { Data ( bytes) }
104+
105+ var hexStr : String {
106+ bytes. map { String ( format: " %02X " , $0) } . joined ( )
107+ }
108+ }
109+
110+ extension String {
111+ var sha1HexString : String {
112+ Insecure . SHA1. hash ( data: data ( using: . utf8) ?? Data ( ) ) . hexStr
113+ }
114+ }
You can’t perform that action at this time.
0 commit comments