SlideShare a Scribd company logo
1 of 26
Download to read offline
UUID
Tomoki Yamashita
2014.4.9 potatotips #6
Self-Introduction
• @tomorrowkey / Tomoki Yamashita
• Android Developer at COOKPAD
• http://blog.tomorrowkey.jp / 明日の
Agenda
• What is UUID?
• How to use it in Java
• Versions of UUID
• Which version can we use in Java
• To use version 1 in Java
• To use version 1 in Android
What is UUID
What is UUID?
• Universally Unique Identifier
• RFC 4122
• Generate Unique ID without servers.
How to use in
Java
How to use it in Java
import java.util.UUID;



public class Main {

public static void main(String... args) {

UUID uuid = UUID.randomUUID();

System.out.println(“uuid=” + uuid.toString());

}

}	
#	
53da3b97-075f-4bcd-af62-148b1a7d6712
Versions of UUID
Versions of UUID
• There are 5 versions of UUID.
Version 1
• Original version
• Use time(nano-seconds) and Mac
Address
• It won't duplicate because depends on
mac address.
Version 2
• Version for DCE(Distributed
Computing Environment) Security
Version 3
• Name and MD5 Hash
• If use the same name, it duplicate.
Version 4
• Random value
• It may not duplicate.
Version 5
• Name and SHA1 Hash
• If use the same name, it duplicate.
Which version can
we use in Java?
Which version can we
use in Java?
• Version 3

UUID.nameUUIDFromBytes(byte[] name)
• Version 4

UUID.randomUUID();
To use version1
in Java
To use version1
in Java
stephenc/eaio-uuid 

https://github.com/stephenc/eaio-uuid
To use version1
in Java
build.gradle

compile ‘com.github.stephenc.eaio-uuid:uuid:3.4.0'	
Main.java

com.eaio.uuid.UUID uuid = new com.eaio.uuid.UUID();

System.out.println(“uuid=” + uuid.toString());
To use version1
in Android
To use version1
in Android
build.gradle

compile ‘com.github.stephenc.eaio-uuid:uuid:3.4.0'	
Main.java

com.eaio.uuid.UUID uuid = new com.eaio.uuid.UUID();

System.out.println(“uuid=” + uuid.toString());
To use version1
in Android
build.gradle

compile ‘com.github.stephenc.eaio-uuid:uuid:3.4.0'	
Main.java

com.eaio.uuid.UUID uuid = new com.eaio.uuid.UUID();

System.out.println(“uuid=” + uuid.toString());
NoClassDefFoundError: com.eaio.uuid.UUID
Why...?
The library use a api which is not
supported in Android.
omg.CORBA.portable.IDLEntity
To use version1
in Android
• clone eaio-uuid
• remove CORBA api from source code.
• add a permission INTERNET
End
Understand principle about UUID and
then use it.
Thank you for listening
Referred links
RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace 

http://tools.ietf.org/html/rfc4122
Universally unique identifier - Wikipedia, the free encyclopedia 

http://en.wikipedia.org/wiki/UUID#Variants_and_versions
UUIDはなぜ、分散環境で好き勝手に生成しても衝突しないのか。RFC4122規格とUUIDの性質。 ¦ 三
度の飯とエレクトロン 

http://blog.katty.in/5124

More Related Content

Similar to UUID

Intro to GWT4Touch 2.0
Intro to GWT4Touch 2.0Intro to GWT4Touch 2.0
Intro to GWT4Touch 2.0
David La Motta
 

Similar to UUID (20)

FLUTTER DHRUVIK.pptx
FLUTTER DHRUVIK.pptxFLUTTER DHRUVIK.pptx
FLUTTER DHRUVIK.pptx
 
Arduino
ArduinoArduino
Arduino
 
20171215 andoird-test-night
20171215 andoird-test-night20171215 andoird-test-night
20171215 andoird-test-night
 
Chw00t: How to break out from various chroot solutions
Chw00t: How to break out from various chroot solutionsChw00t: How to break out from various chroot solutions
Chw00t: How to break out from various chroot solutions
 
What’s new in Sudo 1.8?
What’s new in Sudo 1.8?What’s new in Sudo 1.8?
What’s new in Sudo 1.8?
 
Introduction to Frida
Introduction to FridaIntroduction to Frida
Introduction to Frida
 
Puppetcamp East, Windows Without GPOs, John Rogers, SwissRe
Puppetcamp East, Windows Without GPOs, John Rogers, SwissRePuppetcamp East, Windows Without GPOs, John Rogers, SwissRe
Puppetcamp East, Windows Without GPOs, John Rogers, SwissRe
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
 
Eating Fruit - Combining Robots & Apps
Eating Fruit - Combining Robots & AppsEating Fruit - Combining Robots & Apps
Eating Fruit - Combining Robots & Apps
 
Oscon 2010
Oscon 2010Oscon 2010
Oscon 2010
 
Android
AndroidAndroid
Android
 
Introducing Ubuntu SDK
Introducing Ubuntu SDKIntroducing Ubuntu SDK
Introducing Ubuntu SDK
 
Intro to GWT4Touch 2.0
Intro to GWT4Touch 2.0Intro to GWT4Touch 2.0
Intro to GWT4Touch 2.0
 
Java overview and architecture
Java overview and architectureJava overview and architecture
Java overview and architecture
 
Intro google-android
Intro google-androidIntro google-android
Intro google-android
 
Introduction to Android
Introduction to AndroidIntroduction to Android
Introduction to Android
 
CNIT 128 6. Analyzing Android Applications (Part 3)
CNIT 128 6. Analyzing Android Applications (Part 3)CNIT 128 6. Analyzing Android Applications (Part 3)
CNIT 128 6. Analyzing Android Applications (Part 3)
 
Android Operating System
Android Operating SystemAndroid Operating System
Android Operating System
 
A Prelude to Android
A Prelude to AndroidA Prelude to Android
A Prelude to Android
 
GlobalLogic Education Webinar #6: Challenges of GL Roboclub
GlobalLogic Education Webinar #6: Challenges of GL RoboclubGlobalLogic Education Webinar #6: Challenges of GL Roboclub
GlobalLogic Education Webinar #6: Challenges of GL Roboclub
 

More from Tomoki YAMASHITA (10)

Few command line tools for help Android development
Few command line tools for help Android developmentFew command line tools for help Android development
Few command line tools for help Android development
 
ぼくのビルドはにゃあとなく
ぼくのビルドはにゃあとなくぼくのビルドはにゃあとなく
ぼくのビルドはにゃあとなく
 
Android Studio Pluginを使ってみた
Android Studio Pluginを使ってみたAndroid Studio Pluginを使ってみた
Android Studio Pluginを使ってみた
 
Android SDK Toolsのおさらい
Android SDK ToolsのおさらいAndroid SDK Toolsのおさらい
Android SDK Toolsのおさらい
 
What is androider
What is androiderWhat is androider
What is androider
 
Ndefってなんだろう
NdefってなんだろうNdefってなんだろう
Ndefってなんだろう
 
避けては通れないバイナリ地獄 - NDEFってなんだろう -
避けては通れないバイナリ地獄 - NDEFってなんだろう -避けては通れないバイナリ地獄 - NDEFってなんだろう -
避けては通れないバイナリ地獄 - NDEFってなんだろう -
 
Android NFCアプリハンズオン
Android NFCアプリハンズオンAndroid NFCアプリハンズオン
Android NFCアプリハンズオン
 
NFC QUEST作ったよ
NFC QUEST作ったよNFC QUEST作ったよ
NFC QUEST作ったよ
 
Dialogを使うときはこうしてます
Dialogを使うときはこうしてますDialogを使うときはこうしてます
Dialogを使うときはこうしてます
 

Recently uploaded

Recently uploaded (20)

ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 

UUID

  • 2. Self-Introduction • @tomorrowkey / Tomoki Yamashita • Android Developer at COOKPAD • http://blog.tomorrowkey.jp / 明日の
  • 3. Agenda • What is UUID? • How to use it in Java • Versions of UUID • Which version can we use in Java • To use version 1 in Java • To use version 1 in Android
  • 5. What is UUID? • Universally Unique Identifier • RFC 4122 • Generate Unique ID without servers.
  • 6. How to use in Java
  • 7. How to use it in Java import java.util.UUID;
 
 public class Main {
 public static void main(String... args) {
 UUID uuid = UUID.randomUUID();
 System.out.println(“uuid=” + uuid.toString());
 }
 } # 53da3b97-075f-4bcd-af62-148b1a7d6712
  • 9. Versions of UUID • There are 5 versions of UUID.
  • 10. Version 1 • Original version • Use time(nano-seconds) and Mac Address • It won't duplicate because depends on mac address.
  • 11. Version 2 • Version for DCE(Distributed Computing Environment) Security
  • 12. Version 3 • Name and MD5 Hash • If use the same name, it duplicate.
  • 13. Version 4 • Random value • It may not duplicate.
  • 14. Version 5 • Name and SHA1 Hash • If use the same name, it duplicate.
  • 15. Which version can we use in Java?
  • 16. Which version can we use in Java? • Version 3
 UUID.nameUUIDFromBytes(byte[] name) • Version 4
 UUID.randomUUID();
  • 18. To use version1 in Java stephenc/eaio-uuid 
 https://github.com/stephenc/eaio-uuid
  • 19. To use version1 in Java build.gradle
 compile ‘com.github.stephenc.eaio-uuid:uuid:3.4.0' Main.java
 com.eaio.uuid.UUID uuid = new com.eaio.uuid.UUID();
 System.out.println(“uuid=” + uuid.toString());
  • 21. To use version1 in Android build.gradle
 compile ‘com.github.stephenc.eaio-uuid:uuid:3.4.0' Main.java
 com.eaio.uuid.UUID uuid = new com.eaio.uuid.UUID();
 System.out.println(“uuid=” + uuid.toString());
  • 22. To use version1 in Android build.gradle
 compile ‘com.github.stephenc.eaio-uuid:uuid:3.4.0' Main.java
 com.eaio.uuid.UUID uuid = new com.eaio.uuid.UUID();
 System.out.println(“uuid=” + uuid.toString()); NoClassDefFoundError: com.eaio.uuid.UUID
  • 23. Why...? The library use a api which is not supported in Android. omg.CORBA.portable.IDLEntity
  • 24. To use version1 in Android • clone eaio-uuid • remove CORBA api from source code. • add a permission INTERNET
  • 25. End Understand principle about UUID and then use it. Thank you for listening
  • 26. Referred links RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace 
 http://tools.ietf.org/html/rfc4122 Universally unique identifier - Wikipedia, the free encyclopedia 
 http://en.wikipedia.org/wiki/UUID#Variants_and_versions UUIDはなぜ、分散環境で好き勝手に生成しても衝突しないのか。RFC4122規格とUUIDの性質。 ¦ 三 度の飯とエレクトロン 
 http://blog.katty.in/5124