Return a third party caveat id

        This does not duplicate any third party caveat ids already inside
        macaroon. If base is non-empty, it is used as the id prefix.

        @param base bytes
        @return bytes
326762
def _new_caveat_id(self, base):
        '''
        '''
        id = bytearray()
        if len(base) > 0:
            id.extend(base)
        else:
            # Add a version byte to the caveat id. Technically
            # this is unnecessary as the caveat-decoding logic
            # that looks at versions should never see this id,
            # but if the caveat payload isn't provided with the
            # payload, having this version gives a strong indication
            # that the payload has been omitted so we can produce
            # a better error for the user.
            id.append(VERSION_3)

        # Iterate through integers looking for one that isn't already used,
        # starting from n so that if everyone is using this same algorithm,
        # we'll only perform one iteration.
        i = len(self._caveat_data)
        caveats = self._macaroon.caveats
        while True:
            # We append a varint to the end of the id and assume that
            # any client that's created the id that we're using as a base
            # is using similar conventions - in the worst case they might
            # end up with a duplicate third party caveat id and thus create
            # a macaroon that cannot be discharged.
            temp = id[:]
            encode_uvarint(i, temp)
            found = False
            for cav in caveats:
                if (cav.verification_key_id is not None
                        and cav.caveat_id == temp):
                    found = True
                    break
            if not found:
                return bytes(temp)
            i += 1
623637
public static long getId(int serverId)
	{
		synchronized (seq) {
			long second=System.currentTimeMillis()/1000;
			System.out.println("second:"+second);
			int inc=seq.incrementAndGet();
			System.out.println("inc:"+inc);
			return ((long)(serverId & 0xFFFF))<< 48 | 
					((second & 0x00000000FFFFFFFF) <<16) | (inc & 0x0000FFFF);
		}
	}
1288024
public String getSubscriptionId(FhirContext theFhirContext) {
		String retVal = null;
		if (getSubscription() != null) {
			retVal = getSubscription().getIdElement(theFhirContext).getValue();
		}
		return retVal;
	}
999171
@Override
    public SIBUuid12 getBaseUuid()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getBaseUuid");

        SIBUuid12 uuid = _targetDestinationHandler.getDefinition().getUUID();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getBaseUuid", uuid);

        return uuid;
    }
1277916
public javax.swing.JMenuBar getBaseMenuBar()
	{
		if (baseMenuBar == null)
		{
			baseMenuBar = new javax.swing.JMenuBar();
			baseMenuBar.setName("baseMenuBar");
			baseMenuBar.add(getMenu_File());
			baseMenuBar.add(getMenu_View());
			baseMenuBar.add(getMenu_LookAndFeel());
			baseMenuBar.add(getMenu_Help());
		}
		return baseMenuBar;
	}
251199
public static String getBaseURL(String url) {
		URL u = toURL(url);
		String base = null;
		if (u != null) {
			try {
				base = u.toURI().getScheme().concat("://").concat(u.getAuthority());
			} catch (URISyntaxException ex) {
				base = null;
			}
		}
		return base;
	}
688295
public PatternDescr getBasePattern() {
        if ( this.patterns.size() > 1 ) {
            return (PatternDescr) this.patterns.get( 0 );
        } else if ( this.patterns.size() == 1 ) {
            // in case there is only one pattern, we do a rewrite, so:
            // forall( Cheese( type == "stilton" ) )
            // becomes
            // forall( BASE_IDENTIFIER : Cheese() Cheese( this == BASE_IDENTIFIER, type == "stilton" ) )
            PatternDescr original = (PatternDescr) this.patterns.get( 0 );
            PatternDescr base = (PatternDescr) original.clone();
            base.getDescrs().clear();
            base.setIdentifier( BASE_IDENTIFIER );
            base.setResource(original.getResource());
            return base;
        }
        return null;
    }
1170544
public static String generateRequestId() {
        /* compute a random 256-bit string and hex-encode it */
        final SecureRandom sr = new SecureRandom();
        final byte[] bytes = new byte[32];
        sr.nextBytes(bytes);
        return hexEncode(bytes);
    }
338484
function normalizeId(idFromRoot, root) {
  var id = idFromRoot.substring().trim();
  if (root && id.length > 0 && id[0] === '/') {
    id = id.substring(1);
  }
  id = root + id;
  return id;
}
315729
protected String getId(FaceletContext ctx)
    {
        if (this.id != null)
        {
            return this.id.getValue(ctx);
        }
        return ctx.generateUniqueId(this.tagId);
    }
859265
public String getBaseIdentifier()
  {

    // Try to get the baseIdentifier from the baseIdentifier's stack,
    // which may not be the same thing as the value found in the
    // SourceLocators stack.
    String base = (String) (m_baseIdentifiers.isEmpty()
                            ? null : m_baseIdentifiers.peek());

    // Otherwise try the stylesheet.
    if (null == base)
    {
      SourceLocator locator = getLocator();

      base = (null == locator) ? "" : locator.getSystemId();
    }

    return base;
  }
487409
private String getIdentityFromLegacyId() throws CharacterCodingException {
        byte[] data = legacyId;
        int len = Util.toShort(data, 1);
        return Util.decodeString(data, 3, len);
    }
671576
public BaseTypeId getBaseTypeId(final Class<? extends GraphObject> type) {

		final CMISInfo info = getCMISInfo(type);
		if (info != null) {

			return info.getBaseTypeId();
		}

		return null;
	}
667789
public String getConfigBrowserBasedAuthentication() {

        if (m_useBrowserBasedHttpAuthentication) {
            return Boolean.TRUE.toString();
        } else if (m_browserBasedAuthenticationMechanism != null) {
            return m_browserBasedAuthenticationMechanism;
        } else {
            return Boolean.FALSE.toString();
        }
    }
141344
protected String getIdForNewProcessDefinition(ProcessDefinitionEntity processDefinition) {
        String nextId = idGenerator.getNextId();

        String result = processDefinition.getKey() + ":" + processDefinition.getVersion() + ":" + nextId; // ACT-505
        // ACT-115: maximum id length is 64 characters
        if (result.length() > 64) {
            result = nextId;
        }

        return result;
    }
421677
public static String getUserHomeDir(String base) {
        String userhome = System.getProperty("user.home");
        File file = new File(userhome, base);
        if (file.exists()) {
            if (!file.isDirectory()) {
                // LOGGER.error("{} exists, but not directory", file.getAbsolutePath());
                throw new SofaRpcRuntimeException(file.getAbsolutePath() + " exists, but not directory");
            }
        } else {
            file.mkdirs(); // 可能创建不成功
        }
        return file.getAbsolutePath();
    }
876155
public static int hashUnsafeBytes(Object base, long offset, int lengthInBytes) {
		return hashUnsafeBytes(base, offset, lengthInBytes, DEFAULT_SEED);
	}