Value that must be encoded as a hexadecimal value
@param hexValue example value to use for generated bodies
357447
public static PactDslJsonRootValue hexValue(String hexValue) {
    if (!hexValue.matches(HEXADECIMAL)) {
      throw new InvalidMatcherException(EXAMPLE + hexValue + "\" is not a hexadecimal value");
    }
    PactDslJsonRootValue value = new PactDslJsonRootValue();
    value.setValue(hexValue);
    value.setMatcher(value.regexp("[0-9a-fA-F]+"));
    return value;
  }
202987
private void setValue(Object newValue) {
        try {
            if (this.type == null)
                value = newValue;
            else if (this.type.equals("java.lang.String"))
                value = newValue;
            else if (this.type.equals("java.lang.Boolean"))
                value = Boolean.valueOf((String) newValue);
            else if (this.type.equals("java.lang.Integer"))
                value = new Integer(((String) newValue));
            else if (this.type.equals("java.lang.Double"))
                value = new Double(((String) newValue));
            else if (this.type.equals("java.lang.Byte"))
                value = new Byte(((String) newValue));
            else if (this.type.equals("java.lang.Short"))
                value = new Short(((String) newValue));
            else if (this.type.equals("java.lang.Long"))
                value = new Long(((String) newValue));
            else if (this.type.equals("java.lang.Float"))
                value = new Float(((String) newValue));
            else if (this.type.equals("java.lang.Character")) 
                value = Character.valueOf(((String) newValue).charAt(0)); 
            else
                value = newValue;

        } catch (NumberFormatException nfe) {
            Tr.warning(tc, "INCOMPATIBLE_PROPERTY_TYPE_J2CA0207", new Object[] { name, type, newValue });
        }

    }
204855
public static String toHexString(byte[] value) {
    String newString = "";
    for (int i = 0; i < value.length; i++) {
      byte b = value[i];
      String str = Integer.toHexString(b);
      if (str.length() > 2) {
        str = str.substring(str.length() - 2);
      }
      if (str.length() < 2) {
        str = "0" + str;
      }
      newString += str;
    }
    return newString.toUpperCase();
  }
1138968
@Override
    public Object convertValue(final String valueToConvert) {
        return Integer.valueOf(ParserUtils.stripNonLongChars(valueToConvert));
    }
1131807
public static boolean isHexadecimal(String value) {

        if (value == null || value.length() == 0) {
            return false;
        }

        // validate string is hexadecimal value
        if (! HEX_REGEX_PATTERN.matcher(value).matches()) {
            return false;
        }

        return true;
    }
287723
private void setValueFromObject(byte[] bytes) {
        if (type.equals(QualifiedName_XSD_BASE64_BINARY)) {
            setValue(ProvFactory.getFactory().base64Encoding(bytes));
        } else if (type.equals(QualifiedName_XSD_HEX_BINARY)) {
            setValue(ProvFactory.getFactory().hexEncoding(bytes));
        }
    }
518577
public final void mRULE_HEX() throws RecognitionException {
        try {
            int _type = RULE_HEX;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // InternalXbase.g:16904:10: ( ( '0x' | '0X' ) ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' | '_' )+ ( '#' ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) ) )? )
            // InternalXbase.g:16904:12: ( '0x' | '0X' ) ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' | '_' )+ ( '#' ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) ) )?
            {
            // InternalXbase.g:16904:12: ( '0x' | '0X' )
            int alt1=2;
            int LA1_0 = input.LA(1);

            if ( (LA1_0=='0') ) {
                int LA1_1 = input.LA(2);

                if ( (LA1_1=='x') ) {
                    alt1=1;
                }
                else if ( (LA1_1=='X') ) {
                    alt1=2;
                }
                else {
                    NoViableAltException nvae =
                        new NoViableAltException("", 1, 1, input);

                    throw nvae;
                }
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 1, 0, input);

                throw nvae;
            }
            switch (alt1) {
                case 1 :
                    // InternalXbase.g:16904:13: '0x'
                    {
                    match("0x"); 


                    }
                    break;
                case 2 :
                    // InternalXbase.g:16904:18: '0X'
                    {
                    match("0X"); 


                    }
                    break;

            }

            // InternalXbase.g:16904:24: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' | '_' )+
            int cnt2=0;
            loop2:
            do {
                int alt2=2;
                int LA2_0 = input.LA(1);

                if ( ((LA2_0>='0' && LA2_0<='9')||(LA2_0>='A' && LA2_0<='F')||LA2_0=='_'||(LA2_0>='a' && LA2_0<='f')) ) {
                    alt2=1;
                }


                switch (alt2) {
            	case 1 :
            	    // InternalXbase.g:
            	    {
            	    if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='f') ) {
            	        input.consume();

            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        recover(mse);
            	        throw mse;}


            	    }
            	    break;

            	default :
            	    if ( cnt2 >= 1 ) break loop2;
                        EarlyExitException eee =
                            new EarlyExitException(2, input);
                        throw eee;
                }
                cnt2++;
            } while (true);

            // InternalXbase.g:16904:58: ( '#' ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) ) )?
            int alt4=2;
            int LA4_0 = input.LA(1);

            if ( (LA4_0=='#') ) {
                alt4=1;
            }
            switch (alt4) {
                case 1 :
                    // InternalXbase.g:16904:59: '#' ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) )
                    {
                    match('#'); 
                    // InternalXbase.g:16904:63: ( ( 'b' | 'B' ) ( 'i' | 'I' ) | ( 'l' | 'L' ) )
                    int alt3=2;
                    int LA3_0 = input.LA(1);

                    if ( (LA3_0=='B'||LA3_0=='b') ) {
                        alt3=1;
                    }
                    else if ( (LA3_0=='L'||LA3_0=='l') ) {
                        alt3=2;
                    }
                    else {
                        NoViableAltException nvae =
                            new NoViableAltException("", 3, 0, input);

                        throw nvae;
                    }
                    switch (alt3) {
                        case 1 :
                            // InternalXbase.g:16904:64: ( 'b' | 'B' ) ( 'i' | 'I' )
                            {
                            if ( input.LA(1)=='B'||input.LA(1)=='b' ) {
                                input.consume();

                            }
                            else {
                                MismatchedSetException mse = new MismatchedSetException(null,input);
                                recover(mse);
                                throw mse;}

                            if ( input.LA(1)=='I'||input.LA(1)=='i' ) {
                                input.consume();

                            }
                            else {
                                MismatchedSetException mse = new MismatchedSetException(null,input);
                                recover(mse);
                                throw mse;}


                            }
                            break;
                        case 2 :
                            // InternalXbase.g:16904:84: ( 'l' | 'L' )
                            {
                            if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
                                input.consume();

                            }
                            else {
                                MismatchedSetException mse = new MismatchedSetException(null,input);
                                recover(mse);
                                throw mse;}


                            }
                            break;

                    }


                    }
                    break;

            }


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
624306
function randomValueHex(len) {
    return crypto
        .randomBytes(Math.ceil(len / 2))
        .toString('hex')
        .slice(0, len)
        .toUpperCase();
}
1047932
public static byte[] hexToBytes(char[] hex)
    {
        int length = hex.length / 2;
        byte[] raw = new byte[length];
        for (int i = 0; i < length; i++)
        {
            int high = Character.digit(hex[i * 2], 16);
            int low = Character.digit(hex[i * 2 + 1], 16);
            int value = (high << 4) | low;
            if (value > 127)
            {
                value -= 256;
            }
            raw[i] = (byte) value;
        }
        return raw;
    }
171961
public static Color fromString(final String hexValue) {
        if (ColorHelper.helper == null)
            ColorHelper.helper = new ColorHelper();
        return ColorHelper.helper.getFromString(hexValue);
    }
1225252
static public byte[] asByteArray(long inValue) {

        long value = inValue;
        // check for 0
        if (0 == value) {
            return ZERO_BYTEARRAY;
        }

        // make space for the largest long number
        byte[] bytes = new byte[SIZE_MAXLONG];
        // check for negative ints
        boolean bNegative = false;
        if (0 > value) {
            // force it positive for parsing
            bNegative = true;
            value = -value;
        }
        // now loop back through each digit in the long
        int index = SIZE_MAXLONG - 1;
        for (; 0 <= index && 0 != value; index--) {
            bytes[index] = HEX_BYTES[(int) (value % 10)];
            value /= 10;
        }

        // length is how ever many digits there were + a possible negative sign
        int len = (SIZE_MAXLONG - 1 - index);
        if (bNegative) {
            len++;
        }

        // now copy out the "real bytes" for returning
        byte[] realBytes = new byte[len];
        for (int i = len - 1, x = SIZE_MAXLONG - 1; 0 <= i; i--, x--) {
            realBytes[i] = bytes[x];
        }
        // add negative sign if we need to
        if (bNegative) {
            realBytes[0] = DASH;
        }
        return realBytes;
    }
162015
public static byte[] encodeHexStringToBCD(String hexString) {
        hexString=hexString.toLowerCase();
        int noOfDigits = hexString.length();

        boolean isOdd = noOfDigits % 2 == 0 ? false : true;
        int noOfBytes = noOfDigits / 2;
        if (isOdd) {
            noOfBytes++;
        }
        byte[] bcdDigits = new byte[noOfBytes];

        char[] chars = hexString.toCharArray();
        int digit = -1;
        for (int i = 0; i< noOfDigits; i++) {
            digit = Character.digit(convertTelcoCharToHexDigit(chars[i]), 16);
            byte tmpByte = (byte) digit;
            if (i % 2 == 0) {
                bcdDigits[i / 2] = tmpByte;
            } else {
                bcdDigits[i / 2] |= (byte) (tmpByte << 4);
            }
        }

        return bcdDigits;
    }
108084
public static byte[] decodeBase64(String value) {
        int byteShift = 4;
        int tmp = 0;
        boolean done = false;
        final StringBuilder buffer = new StringBuilder();

        for (int i = 0; i != value.length(); i++) {
            final char c = value.charAt(i);
            final int sixBit = (c < 123) ? EncodingGroovyMethodsSupport.TRANSLATE_TABLE[c] : 66;

            if (sixBit < 64) {
                if (done)
                    throw new RuntimeException("= character not at end of base64 value"); // TODO: change this exception type

                tmp = (tmp << 6) | sixBit;

                if (byteShift-- != 4) {
                    buffer.append((char) ((tmp >> (byteShift * 2)) & 0XFF));
                }

            } else if (sixBit == 64) {

                byteShift--;
                done = true;

            } else if (sixBit == 66) {
                // RFC 2045 says that I'm allowed to take the presence of
                // these characters as evidence of data corruption
                // So I will
                throw new RuntimeException("bad character in base64 value"); // TODO: change this exception type
            }

            if (byteShift == 0) byteShift = 4;
        }

        try {
            return buffer.toString().getBytes("ISO-8859-1");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("Base 64 decode produced byte values > 255"); // TODO: change this exception type
        }
    }
675908
public String encryptPropertyValue(String propertyValue) {
        byte[] bytes = cryptex.encryptString(key, propertyValue);
        String encryptedValue = Base64Utils.encode(bytes);
        return ENCRYPTED_NOTATION + encryptedValue;
    }
1317107
public static byte[] decode(String hexa) throws CoderException {
	if (hexa == null) {
	    throw new CoderException("can't decode empty String");
	}
	if ((hexa.length() % 2) != 0) {
	    throw new CoderException("invalid hexadecimal String");
	}
	int tamArray = hexa.length() / 2;
	byte[] retorno = new byte[tamArray];
	for (int i = 0; i < tamArray; i++) {
	    retorno[i] = hexToByte(hexa.substring(i * 2, i * 2 + 2));
	}
	return retorno;
    }
1311372
public static String hexMD5(String value) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("MD5");
            messageDigest.reset();
            messageDigest.update(value.getBytes("utf-8"));
            byte[] digest = messageDigest.digest();
            return byteToHexString(digest);
        } catch (Exception ex) {
            throw new UnexpectedException(ex);
        }
    }
155328
function convertData2Hexd (data) {
  if (!isHexString(data)) {
    var hex = ''
    for (var i = 0; i < data.length; i++) {
      hex += data.charCodeAt(i).toString(16)
    }
    return '0x' + hex
  }
  return data
}