当前位置: 首页>>代码示例>>Java>>正文


Java HexBin类代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.dv.util.HexBin的典型用法代码示例。如果您正苦于以下问题:Java HexBin类的具体用法?Java HexBin怎么用?Java HexBin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HexBin类属于com.sun.org.apache.xerces.internal.impl.dv.util包,在下文中一共展示了HexBin类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeMd5

import com.sun.org.apache.xerces.internal.impl.dv.util.HexBin; //导入依赖的package包/类
private static CompletableFuture<String> computeMd5(Path path) {
    return CompletableFuture.supplyAsync(() -> {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");  // Possibly use a different hashing algorithm

            try (InputStream is = Files.newInputStream(path);
                 DigestInputStream dis = new DigestInputStream(is, md)) {
                int readByte;

                do {
                    readByte = dis.read();
                } while(readByte != -1);
            }

            byte[] bytes = md.digest();

            return HexBin.encode(bytes);
        } catch (IOException | NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }, MineskinSponge.getInstance().getAsyncExecutor());
}
 
开发者ID:Limeth,项目名称:MineskinSponge,代码行数:23,代码来源:MineskinServiceImpl.java

示例2: getActualValue

import com.sun.org.apache.xerces.internal.impl.dv.util.HexBin; //导入依赖的package包/类
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
    byte[] decoded = HexBin.decode(content);
    if (decoded == null)
        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "hexBinary"});

    return new XHex(decoded);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:HexBinaryDV.java

示例3: initSecondPage

import com.sun.org.apache.xerces.internal.impl.dv.util.HexBin; //导入依赖的package包/类
public void initSecondPage() {
	components.clear();
	TextButton back = new TextButton((Game.getWidth() - (TextButton.WIDTH + 40)) / 2 + 20, 320, "Zurück");
	back.addClickEvent(new ClickEvent() {
		@Override
		public void trigger() {
			initFirstPage();
		}
	});
	components.add(back);
	
	username = new InputField(back.getX(), back.getY() + TextButton.HEIGHT, TextButton.WIDTH, 40);
	username.setAllowed("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890öäüÖÄÜß");
	username.setHint("Benutzername");
	components.add(username);
	
	password = new InputField(back.getX(), back.getY() + TextButton.HEIGHT * 2, TextButton.WIDTH, 40);
	password.setPassword(true);
	String allowed = password.getAllowed();
	allowed += ",;.:-_#'+*~!§$%&/()=?<>| ";
	password.setAllowed(allowed);
	password.setHint("Passwort");
	components.add(password);
	
	login = new TextButton(back.getX(), back.getY() + TextButton.HEIGHT * 3, "Anmelden");
	login.enabled = false;
	login.addClickEvent(new ClickEvent() {
		@Override
		public void trigger() {
			try {
				final String pw = new String(HexBin.encode(MessageDigest.getInstance("MD5").digest(password.getText().getBytes()))).toLowerCase();
				Game.client.sendPacket(new Packet01Login(username.getText(), pw, Game.worldID));
				Game.currentGame.addLayer(new LoadingLayer());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
	components.add(login);
}
 
开发者ID:Dakror,项目名称:Arise,代码行数:41,代码来源:LoginLayer.java

示例4: MD5

import com.sun.org.apache.xerces.internal.impl.dv.util.HexBin; //导入依赖的package包/类
public static String MD5(byte[] b) {
	MessageDigest md = null;
	try {
		md = MessageDigest.getInstance("MD5");
	} catch (NoSuchAlgorithmException e) {
		e.printStackTrace();
	}
	return HexBin.encode(md.digest(b));
}
 
开发者ID:Dakror,项目名称:VirtualHub,代码行数:10,代码来源:Assistant.java

示例5: toString

import com.sun.org.apache.xerces.internal.impl.dv.util.HexBin; //导入依赖的package包/类
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:HexBinaryDV.java

示例6: toSha1

import com.sun.org.apache.xerces.internal.impl.dv.util.HexBin; //导入依赖的package包/类
public String toSha1(String input) {
    mdSha1.reset();
    mdSha1.update(input.getBytes());

    return HexBin.encode(mdSha1.digest());
}
 
开发者ID:sohelzerdoumi,项目名称:StKeys,代码行数:7,代码来源:StKeys.java

示例7: testNumericEncoder

import com.sun.org.apache.xerces.internal.impl.dv.util.HexBin; //导入依赖的package包/类
public void testNumericEncoder() {


        Encoders.Numeric enc = new Encoders.Numeric();
        byte []bs = enc.encode((3.4456)).get(0);

        assertEquals("400B9096BB98C7E3",HexBin.encode(enc.encode((3.4456d)).get(0)));
        assertEquals("405C84B6",HexBin.encode(enc.encode((float)3.4456).get(0)));
        assertTrue(HexBin.encode(enc.encode(3.4456).get(0)).compareTo(HexBin.encode(enc.encode((2.4456)).get(0))) > 0);

        assertEquals("0000000000000005",HexBin.encode(enc.encode(5).get(0)));


    }
 
开发者ID:RedisLabs,项目名称:ReSearch,代码行数:15,代码来源:EncodersTest.java


注:本文中的com.sun.org.apache.xerces.internal.impl.dv.util.HexBin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。