List of usage examples for java.util UUID nameUUIDFromBytes
public static UUID nameUUIDFromBytes(byte[] name)
From source file:com.feedzai.fos.impl.dummy.DummyManager.java
@Override public UUID trainAndAddFile(ModelConfig config, String path) throws FOSException { return UUID.nameUUIDFromBytes(new byte[0]); }
From source file:org.diorite.impl.server.connection.ThreadPlayerLookupUUID.java
@Override public void run() { final GameProfileImpl oldProfile = this.loginListener.getGameProfile(); try {/*from w w w . j av a 2 s. c o m*/ if (this.loginListener.getOnlineMode() != OnlineMode.TRUE) // TODO { this.loginListener.setUUID(UUID.nameUUIDFromBytes( ("OfflinePlayer:" + oldProfile.getName()).getBytes(StandardCharsets.UTF_8))); this.allow(); return; } final KeyPair serverKeyPair = this.getServer().getKeyPair(); final String hash = new BigInteger(MinecraftEncryption.combineKeys(this.loginListener.getServerID(), serverKeyPair.getPublic(), this.loginListener.getSecretKey())).toString(16); final GameProfileImpl newProfile = this.getServer().getSessionService().hasJoinedServer(oldProfile, hash); this.loginListener.setGameProfile(newProfile); if (newProfile == null) { this.loginListener.disconnect("Failed to verify username!"); this.loginListener.getLogger() .error("Username '" + oldProfile.getName() + "' tried to join with an invalid session"); GameProfiles.addEmptyEntry(oldProfile.getName(), UUID.nameUUIDFromBytes( ("OfflinePlayer:" + oldProfile.getName()).getBytes(StandardCharsets.UTF_8))); return; } GameProfiles.addToCache(newProfile); this.allow(); } catch (final AuthenticationUnavailableException serverEx) { this.loginListener.disconnect("Authentication servers are down. Please try again later, sorry!"); this.loginListener.getLogger().error("Couldn't verify username because servers are unavailable"); } catch (final Exception e) { e.printStackTrace(); this.loginListener.disconnect("Failed to verify username!"); this.loginListener.getLogger() .error("Username '" + oldProfile.getName() + "' tried to join with an invalid session"); } }
From source file:com.ibm.mobilefirstplatform.clientsdk.android.security.identity.BaseDeviceIdentity.java
/** * @param context android application context * @return device unique id/*from w w w. j ava 2 s.c o m*/ */ private String getDeviceUUID(Context context) { String uuid = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); return UUID.nameUUIDFromBytes(uuid.getBytes()).toString(); }
From source file:org.apache.cassandra.schema.IndexMetadata.java
private IndexMetadata(String name, Map<String, String> options, Kind kind) { this.id = UUID.nameUUIDFromBytes(name.getBytes()); this.name = name; this.options = options == null ? ImmutableMap.of() : ImmutableMap.copyOf(options); this.kind = kind; }
From source file:pl.edu.icm.coansys.source.MapDocProtosToSourceBasIds.java
@Override protected void map(Writable key, BytesWritable value, Context context) throws IOException, InterruptedException { DocumentProtos.DocumentWrapper docWrapper = DocumentProtos.DocumentWrapper.parseFrom(value.copyBytes()); String issn = null;//from w w w. j a va2 s. c o m String isbn = null; if (docWrapper.hasDocumentMetadata() && docWrapper.getDocumentMetadata().hasBasicMetadata()) { DocumentProtos.BasicMetadataOrBuilder bm = docWrapper.getDocumentMetadata().getBasicMetadataOrBuilder(); if (bm.hasParentType()) { if (bm.getParentType() == DocumentProtos.BasicMetadata.ParentType.BLOG) { // No blog disambiguation yet return; } } if (bm.hasIssn()) { issn = bm.getIssn(); } if (bm.hasIsbn()) { isbn = bm.getIsbn(); } if (StringUtils.isBlank(isbn)) { isbn = null; } if (StringUtils.isBlank(issn)) { issn = null; } } if (issn != null) { String id = issn.replaceAll("\\W", "").toUpperCase(); // issn ni a ma znakw spoza 7 bitow UUID uuid = UUID.nameUUIDFromBytes(("issn" + id).getBytes(Charset.forName("US-ASCII"))); context.write(new Text(uuid.toString()), value); } if (isbn != null) { String id = isbn.replaceAll("\\W", "").toUpperCase(); // issn ni a ma znakw spoza 7 bitow UUID uuid = UUID.nameUUIDFromBytes(("isbn" + id).getBytes(Charset.forName("US-ASCII"))); context.write(new Text(uuid.toString()), value); } }
From source file:com.raphfrk.craftproxyclient.net.auth.AuthManager.java
@SuppressWarnings("unchecked") public static JSONObject authAccessToken(String email, String password) { String clientToken = null;//from w w w. j a v a 2s . c o m JSONObject fileObj = readAccessToken(); if (fileObj != null) { clientToken = (String) fileObj.get("clientToken"); } if (clientToken == null) { byte[] arr = new byte[32]; Crypt.getBytes(arr); clientToken = UUID.nameUUIDFromBytes(arr).toString(); } JSONObject obj = new JSONObject(); JSONObject agent = new JSONObject(); agent.put("name", "Minecraft"); agent.put("version", 1); obj.put("agent", agent); obj.put("username", email); obj.put("password", password); obj.put("clientToken", clientToken); JSONObject reply = sendRequest(obj, "authenticate"); if (reply == null) { return null; } JSONObject stripped = stripLoginDetails(reply, true); if (stripped == null) { return null; } writeAccessToken(stripped); AuthManager.loginDetails = stripped; return reply; }
From source file:org.photovault.folder.FolderPhotoAssociation.java
/** Calculate the uuid based on the photo and folder identities @return The calculated uuid/* w ww .j a va 2 s. c o m*/ */ private UUID calcUuid() { if (photo == null || folder == null) { return null; } String uuidStr = folder.getUuid().toString() + photo.getUuid().toString(); byte[] b; try { b = uuidStr.getBytes("utf-8"); return UUID.nameUUIDFromBytes(b); } catch (UnsupportedEncodingException ex) { log.error("UTF-8 not supported!!!", ex); } return null; }
From source file:org.fragzone.unrealmmo.bukkit.entities.npcs.NPCProfile.java
/** * Create a NPCProfile based on name.//from w ww.j ava 2 s . c o m * Note: this will allways have a steve skin. * * @param name Name of steve npc. */ public NPCProfile(String name) { this(); this.uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)); this.name = name; }
From source file:org.wso2.carbon.dataservices.core.custom.datasource.AbstractCustomDataSourceReader.java
private void populateStandardProps(Map<String, String> dsProps) { String dsInfo = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId() + "###" + DataSourceUtils.getCurrentDataSourceId(); dsProps.put(DBConstants.CustomDataSource.DATASOURCE_ID, UUID .nameUUIDFromBytes(dsInfo.getBytes(Charset.forName(DBConstants.DEFAULT_CHAR_SET_TYPE))).toString()); if (log.isDebugEnabled()) { log.debug("Custom Carbon Data Source; ID: " + dsInfo + " UUID:" + dsProps.get(DBConstants.CustomDataSource.DATASOURCE_ID)); }// www .j a v a 2 s . c om }