Skip to content

Tiny Swift code to generate namespace-based UUID using CommonCrypto

License

Notifications You must be signed in to change notification settings

nuekodory/Swift-UUIDv3-UUIDv5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

OBSOLETE CODE

There are some vulnerabilities. Consider using baarde/uuid-kit instead.

XCode might suggest:

  • CC_MD5 is outdated
  • Insufficient use of UnsafeBufferPointer

Swift+UUIDv3+UUIDv5

Tiny Swift code to generate namespace-based UUID (UUID version3 and 5) using CommonCrypto.

Compatible with Swift3/4/5

Usage

Just put UUIDv3v5.swift on your project.

Sample Code

import Foundation       // use UUID defined in Foundation

let dnsUuid = UUID(uuidVersion: 3, namespace: UUID.namespace.DNS, name: "github.com")
let urlUuid = UUID(uuidVersion: 5, namespace: UUID.namespace.URL, name: "https://github.com/nuekodory/Swift-UUIDv3-UUIDv5/")
// dnsUuid: UUID? = 7F4771A0-1982-373D-928F-D31140A51652
// urlUuid: UUID? = C6E8FD06-74BB-504E-8550-A4C64F6294B9

Requirements

About

Tiny Swift code to generate namespace-based UUID using CommonCrypto

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages