本文整理汇总了Java中com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction类的典型用法代码示例。如果您正苦于以下问题:Java Sha1DigestFunction类的具体用法?Java Sha1DigestFunction怎么用?Java Sha1DigestFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sha1DigestFunction类属于com.google.ipc.invalidation.common.ObjectIdDigestUtils包,在下文中一共展示了Sha1DigestFunction类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createDigestedState
import com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction; //导入依赖的package包/类
/**
* Returns a {@link AndroidTiclStateWithDigest} containing {@code ticlState} and its computed
* digest.
*/
private static AndroidTiclStateWithDigest createDigestedState(
AndroidInvalidationClientImpl ticl) {
Sha1DigestFunction digester = new Sha1DigestFunction();
ApplicationClientIdP ticlAppId = ticl.getApplicationClientIdP();
Metadata metaData = Metadata.newBuilder()
.setClientConfig(ticl.getConfig())
.setClientName(ticlAppId.getClientName())
.setClientType(ticlAppId.getClientType())
.setTiclId(ticl.getSchedulingId())
.build();
AndroidTiclState state = AndroidTiclState.newBuilder()
.setMetadata(metaData)
.setTiclState(ticl.marshal())
.setVersion(ProtocolIntents.ANDROID_PROTOCOL_VERSION_VALUE).build();
digester.update(state.toByteArray());
AndroidTiclStateWithDigest verifiedState = AndroidTiclStateWithDigest.newBuilder()
.setState(state)
.setDigest(ByteString.copyFrom(digester.getDigest()))
.build();
return verifiedState;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:26,代码来源:TiclStateManager.java
示例2: createDigestedState
import com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction; //导入依赖的package包/类
/**
* Returns a {@link AndroidTiclStateWithDigest} containing {@code ticlState} and its computed
* digest.
*/
private static AndroidTiclStateWithDigest createDigestedState(
AndroidInvalidationClientImpl ticl) {
Sha1DigestFunction digester = new Sha1DigestFunction();
ApplicationClientIdP ticlAppId = ticl.getApplicationClientIdP();
Metadata metadata = Metadata.create(ticlAppId.getClientType(), ticlAppId.getClientName(),
ticl.getSchedulingId(), ticl.getConfig());
AndroidTiclState state = AndroidTiclState.create(ProtocolIntents.ANDROID_PROTOCOL_VERSION_VALUE,
ticl.marshal(), metadata,
((AndroidInternalScheduler) ticl.getResources().getInternalScheduler()).marshal());
digester.update(state.toByteArray());
AndroidTiclStateWithDigest verifiedState =
AndroidTiclStateWithDigest.create(state, new Bytes(digester.getDigest()));
return verifiedState;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:TiclStateManager.java
示例3: isDigestValid
import com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction; //导入依赖的package包/类
/** Returns whether the digest in {@code state} is correct. */
private static boolean isDigestValid(AndroidTiclStateWithDigest state, Logger logger) {
Sha1DigestFunction digester = new Sha1DigestFunction();
digester.update(state.getState().toByteArray());
byte[] computedDigest = digester.getDigest();
if (!TypedUtil.<Bytes>equals(new Bytes(computedDigest), state.getDigest())) {
logger.warning("Android TICL state digest mismatch; computed %s for %s",
computedDigest, state);
return false;
}
return true;
}
开发者ID:mogoweb,项目名称:365browser,代码行数:13,代码来源:TiclStateManager.java
示例4: isDigestValid
import com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction; //导入依赖的package包/类
/** Returns whether the digest in {@code state} is correct. */
private static boolean isDigestValid(AndroidTiclStateWithDigest state, Logger logger) {
Sha1DigestFunction digester = new Sha1DigestFunction();
digester.update(state.getState().toByteArray());
ByteString computedDigest = ByteString.copyFrom(digester.getDigest());
if (!computedDigest.equals(state.getDigest())) {
logger.warning("Android Ticl state digest mismatch; computed %s for %s",
computedDigest, state);
return false;
}
return true;
}
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:TiclStateManager.java
注:本文中的com.google.ipc.invalidation.common.ObjectIdDigestUtils.Sha1DigestFunction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论