本文整理了Java中net.i2p.data.Hash.toBase64()
方法的一些代码示例,展示了Hash.toBase64()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hash.toBase64()
方法的具体详情如下:
包路径:net.i2p.data.Hash
类名称:Hash
方法名:toBase64
暂无
代码示例来源:origin: i2p/i2p.i2p
/**
* Copied/modded from PersistentDataStore
*/
private static String getRouterInfoName(Hash hash) {
String b64 = hash.toBase64();
return ROUTERINFO_PREFIX + b64 + ROUTERINFO_SUFFIX;
}
}
代码示例来源:origin: i2p/i2p.i2p
private String getRouterInfoName(Hash hash) {
String b64 = hash.toBase64();
if (_flat)
return ROUTERINFO_PREFIX + b64 + ROUTERINFO_SUFFIX;
return DIR_PREFIX + b64.charAt(0) + File.separatorChar + ROUTERINFO_PREFIX + b64 + ROUTERINFO_SUFFIX;
}
代码示例来源:origin: i2p/i2p.i2p
/**
* Prettify the hash by doing a base64 and returning the first 6 characters
*
*/
private final static String getName(Hash router) {
if (router == null) return "unknown";
String str = router.toBase64();
if ( (str == null) || (str.length() < 6) ) return "invalid";
return str.substring(0, 6);
}
代码示例来源:origin: i2p/i2p.i2p
@Override
public String toString() {
StringBuilder buf = new StringBuilder(64);
buf.append("Test peer ").append(_peer.toBase64().substring(0,4));
buf.append(" with nonce ").append(_nonce);
return buf.toString();
}
}
代码示例来源:origin: i2p/i2p.i2p
/**
* We banlisted the peer
*/
public void banlist(Hash peer, String reason) {
if (!_doLog) return;
if (peer == null) return;
addEntry("Banlist " + peer.toBase64() + ": " + reason);
}
代码示例来源:origin: i2p/i2p.i2p
/**
* We unbanlisted the peer
*/
public void unbanlist(Hash peer) {
if (!_doLog) return;
if (peer == null) return;
addEntry("Unbanlist " + peer.toBase64());
}
代码示例来源:origin: i2p/i2p.i2p
private File pickFile(PeerProfile profile) {
String hash = profile.getPeer().toBase64();
File dir = new File(_profileDir, DIR_PREFIX + hash.charAt(0));
return new File(dir, PREFIX + hash + SUFFIX);
}
代码示例来源:origin: i2p/i2p.i2p
@Override
public String toString() {
StringBuilder buf = new StringBuilder(32);
buf.append("Session: ");
if (_myDestination != null)
buf.append(_myDestination.calculateHash().toBase64().substring(0, 4));
else
buf.append("[null dest]");
buf.append(getPrefix());
return buf.toString();
}
}
代码示例来源:origin: i2p/i2p.i2p
void updateTunnelTestTimeAverage(long ms) {
if (_tunnelTestResponseTimeAvg <= 0)
_tunnelTestResponseTimeAvg = 30*1000; // should we instead start at $ms?
// weighted since we want to let the average grow quickly and shrink slowly
if (ms < _tunnelTestResponseTimeAvg)
_tunnelTestResponseTimeAvg = 0.95f * _tunnelTestResponseTimeAvg + .05f * ms;
else
_tunnelTestResponseTimeAvg = 0.75f * _tunnelTestResponseTimeAvg + .25f * ms;
if (_log.shouldLog(Log.INFO))
_log.info("Updating tunnel test time for " + _peer.toBase64().substring(0,6)
+ " to " + _tunnelTestResponseTimeAvg + " via " + ms);
}
代码示例来源:origin: i2p/i2p.i2p
@Override
public SessionKey remove(Object o) {
SessionKey rv = super.remove(o);
if (rv != null && o instanceof Hash) {
Hash h = (Hash) o;
_ctx.router().saveConfig(PROP_PFX + h.toBase64().replace("=", "$"), null);
}
return rv;
}
代码示例来源:origin: i2p/i2p.i2p
/** client */
public LeaseSetKeys unregisterKeys(Destination dest) {
if (_log.shouldLog(Log.INFO))
_log.info("Unregistering keys for destination " + dest.calculateHash().toBase64());
return _leaseSetKeys.remove(dest.calculateHash());
}
代码示例来源:origin: i2p/i2p.i2p
/** client */
public void registerKeys(Destination dest, SigningPrivateKey leaseRevocationPrivateKey, PrivateKey endpointDecryptionKey) {
if (_log.shouldLog(Log.INFO))
_log.info("Registering keys for destination " + dest.calculateHash().toBase64());
LeaseSetKeys keys = new LeaseSetKeys(dest, leaseRevocationPrivateKey, endpointDecryptionKey);
_leaseSetKeys.put(dest.calculateHash(), keys);
}
代码示例来源:origin: i2p/i2p.i2p
@Override
public SessionKey put(Hash h, SessionKey sk) {
SessionKey old = super.put(h, sk);
if (!sk.equals(old)) {
_ctx.router().saveConfig(PROP_PFX + h.toBase64().replace("=", "$"),
sk.toBase64());
}
return old;
}
代码示例来源:origin: i2p/i2p.i2p
public void tunnelDispatched(long messageId, long tunnelId, long toTunnel, Hash toPeer, String type) {
if (!_doLog) return;
if (toPeer != null)
addEntry(getPrefix() + "message " + messageId + " on tunnel " + tunnelId + " / " + toTunnel + " to " + toPeer.toBase64() + " as " + type);
else
addEntry(getPrefix() + "message " + messageId + " on tunnel " + tunnelId + " / " + toTunnel + " as " + type);
}
代码示例来源:origin: i2p/i2p.i2p
/**
* Note that there was some sort of communication error talking with the peer
*
*/
public void commErrorOccurred(Hash peer) {
if (_log.shouldLog(Log.INFO))
_log.info("Comm error occurred for peer " + peer.toBase64(), new Exception("Comm error"));
PeerProfile data = getProfile(peer);
//if (data == null) return;
data.setLastSendFailed(_context.clock().now());
}
代码示例来源:origin: i2p/i2p.i2p
void replyVerified() {
if (_log.shouldLog(Log.INFO))
_log.info("Peer reply from " + _peer.toBase64());
_repliesPendingVerification--;
getContext().statManager().addRateData("netDb.searchReplyValidated", 1);
}
void replyNotVerified() {
代码示例来源:origin: i2p/i2p.i2p
void replyNotVerified() {
if (_log.shouldLog(Log.INFO))
_log.info("Peer reply from " + _peer.toBase64());
_repliesPendingVerification--;
_invalidPeers++;
getContext().statManager().addRateData("netDb.searchReplyNotValidated", 1);
}
}
代码示例来源:origin: i2p/i2p.i2p
public BandwidthLimitedOutputStream(RouterContext context, OutputStream source, RouterIdentity peer) {
super(source);
_context = context;
_peer = peer;
if (peer != null)
_peerTarget = peer.getHash().toBase64();
else
_peerTarget = "unknown";
_log = context.logManager().getLog(BandwidthLimitedOutputStream.class);
_currentRequest = null;
}
代码示例来源:origin: i2p/i2p.i2p
public void runJob() {
if (!_keepTesting) return;
Set<RouterInfo> peers = selectPeersToTest();
if (_log.shouldLog(Log.DEBUG))
_log.debug("Testing " + peers.size() + " peers");
for (RouterInfo peer : peers) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Testing peer " + peer.getIdentity().getHash().toBase64());
testPeer(peer);
}
requeue(getPeerTestDelay());
}
代码示例来源:origin: i2p/i2p.i2p
public void runJob() {
long responseTime = getContext().clock().now() - _testBegin;
if (_log.shouldLog(Log.DEBUG))
_log.debug("successful peer test after " + responseTime + " for "
+ _peer.getIdentity().getHash().toBase64() + " using outbound tunnel "
+ _sendTunnel + " and inbound tunnel "
+ _replyTunnel);
getContext().profileManager().dbLookupSuccessful(_peer.getIdentity().getHash(), responseTime);
// we know the tunnels are working
_sendTunnel.testSuccessful((int)responseTime);
_replyTunnel.testSuccessful((int)responseTime);
}
内容来源于网络,如有侵权,请联系作者删除!