CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Functions | Variables
blowfish.cc File Reference
#include "blowfish.h"

Go to the source code of this file.

Macros

#define N   16
 

Functions

void Blowfish_Decrypt (BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)
 
void Blowfish_Encrypt (BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)
 
void Blowfish_Init (BLOWFISH_CTX *ctx, unsigned char *key, int keyLen)
 
static uInt32 F (BLOWFISH_CTX *ctx, uInt32 x)
 

Variables

static const uInt32 ORIG_P [16+2]
 
static const uInt32 ORIG_S [4][256]
 

Macro Definition Documentation

#define N   16

Definition at line 9 of file blowfish.cc.

Referenced by StripCPEgeometric::WrappedCluster::addSuppressedEdgeStrip(), HLTJetMETDQMSource::analyze(), HcalTimingMonitorModule::analyze(), HcalDetDiagTimingMonitor::analyze(), HcalDetDiagLaserMonitor::analyze(), apply(), asHepVector(), PFRecHitCaloNavigator< CaloTowerDetId, CaloTowerTopology >::associateNeighbours(), PFRecHitCaloNavigatorWithTime< EEDetId, EcalEndcapTopology >::associateNeighbours(), HLTJetMETDQMSource::beginRun(), JetCorrectorParameters::binIndex(), BinLogLikelihoodRatio(), Blowfish_Decrypt(), Blowfish_Encrypt(), Blowfish_Init(), JetMETHLTOfflineSource::bookHistograms(), FWBeamSpotProxyBuilder::build(), PhysicsTools::LeastSquares::calculate(), edm::VecArray< std::pair< int, int >, 9 >::capacity(), StripCPEgeometric::WrappedCluster::centroid(), RPCSeedOverlapper::CheckOverlap(), clangcms::FiniteMathChecker::checkPreStmt(), cond::persistency::compareTags(), dtCalibration::DTVDriftMeanTimer::compute(), SimpleJetCorrector::correctionBin(), tauImpactParameter::ParticleBuilder::createLorentzVectorParticle(), reco::NamedCompositeCandidate::daughter(), reco::CompositeCandidate::daughter(), StripCPEgeometric::WrappedCluster::deformed(), SingleGaussianState< N >::dimension(), MultiGaussianState< N >::dimension(), dot(), RPCEfficiencySecond::dqmEndJob(), EcalZmassClient::dqmEndJob(), TEveEllipsoidProjectedGL::DrawRhoZ(), StripCPEgeometric::WrappedCluster::dropSmallerEdgeStrip(), DTVDriftCalibration::endJob(), cond::serialization::access< T[N]>::equal_(), cond::serialization::access< std::array< T, N > >::equal_(), LA_Filler_Fitter::fill(), MuonResiduals1DOFFitter::fit(), MuonResidualsAngleFitter::fit(), MuonResidualsBfieldAngleFitter::fit(), MuonResidualsPositionFitter::fit(), CalibrationAlgorithm::fitPulse(), CSCFindPeakTime::fivePoleFitCharge(), fnc_dscb(), fnc_gaussalpha(), fnc_gaussalpha1alpha2(), TopologyWorker::fowo(), ProjectMatrix< T, N, D >::fromH(), GraphPath< N, E >::fromTo(), mathSSE::Vec4< double >::get1(), mathSSE::Vec2< float >::get1(), mathSSE::Vec4< align::Scalar >::get1(), PFEnergyResolution::getEnergyResolutionEm(), fit::RootMinuit< Function >::getErrorMatrix(), ReferenceTrajectory::getHitProjectionMatrixT(), GetMEAN(), PhysicsTools::LeastSquares::getMeans(), RPCSeedPattern::getSpecialAlgorithmErrorMatrix(), graph_combine(), h2DSegm::h2DSegm(), h4DSegm::h4DSegm(), magfieldparam::HarmBasis3DCyl::HarmBasis3DCyl(), HistoExists(), magfieldparam::poly2d_base::IncNPwr(), SiTrivialInduceChargeOnStrips::induceVector(), ThePEG::HepMCConverter< HepMCEventT, Traits >::init(), MultiGaussianStateTransform::innerMultiState1D(), SimpleJetCorrector::invert(), DDBase< DDName, DDRotationMatrix * >::isDefined(), mayown_ptr< T, N >::isOwn(), PerigeeConversions::jacobianCurvilinear2Perigee(), PerigeeConversions::jacobianPerigee2Curvilinear(), PhysicsTools::LeastSquares::load(), StripCPEfromTrackAngle::localParameters(), mayown_ptr< T, N >::markOwn(), edm::EventSelector::maskTriggerResults(), StripCPEgeometric::WrappedCluster::maxProjection(), StripCPEgeometric::WrappedCluster::middle(), MultiGaussianStateTransform::multiState1D(), BitArray< 9 >::nBits(), DTTFBitArray< N >::nBits(), JetCorrectorParameters::neighbourBin(), BitArray< 9 >::nWords(), DTTFBitArray< N >::nWords(), KalmanTrackToTrackCovCalculator< N >::operator()(), TtHadLRSignalSelObservables::operator()(), TtSemiLRSignalSelObservables::operator()(), SaturationFcn::operator()(), CSCThrTurnOnFcn::operator()(), MultiGaussianStateTransform::outerMultiState1D(), JetResolution::parameter(), JetResolution::parameterEtaEval(), TopologyWorker::planes_sphe(), TopologyWorker::planes_sphe_wei(), mayown_ptr< T, N >::pointer(), polevlf(), RecoTauCleanerImpl< Prod >::produce(), ProjectMatrix< T, N, D >::project(), ProjectMatrix< T, N, D >::projectAndSubtractFrom(), TempTrajectory::push(), edm::VecArray< std::pair< int, int >, 9 >::push_back(), cscdqm::Summary::ReadErrorChambers(), cscdqm::Summary::ReadReportingChambersRef(), DTSegmentUpdator::rejectBadHits(), PFMuonAlgo::removeDeadCandidates(), edm::VecArray< std::pair< int, int >, 9 >::resize(), JetResolution::resolution(), EnergyResolutionVsLumi::Resolution(), magfieldparam::rz_harm_poly::rz_harm_poly(), magfieldparam::rz_poly::rz_poly(), TopologyWorker::sanda(), HcalDetDiagLaserMonitor::SaveRaddamData(), SaturationFcn::set_data(), HLTJetMETDQMSource::PathInfo::setHistos(), JetMETHLTOfflineSource::PathInfo::setHistos(), CosmicMuonGenerator::setNumberOfEvents(), function::ZMuTrackScaledFunction::setParameters(), function::ZMuStandaloneScaledFunction::setParameters(), function::ZMuTrackFunction::setParameters(), CosmicMuonGenerator::setRanSeed(), magfieldparam::poly2d_base::SetTabSize(), magfieldparam::rz_harm_poly::SetTrigArrSize(), MonitorElement::ShiftFillLast(), DoubleCrystalBallGenerator::shoot(), cscdqm::Utility::SignificanceLevelHigh(), stat_RMS(), StripCPEgeometric::WrappedCluster::sumQ(), reco::tau::takeNElements(), edm::EventSelector::testSelectionOverlap(), CSCSegment::time(), GsfMatrixTools::trace(), KalmanVertexTrackUpdator< N >::trackRefit(), npstat::transposeBuffer(), SimpleJetCorrectionUncertainty::uncertaintyBin(), SurveyOutput::write(), and HFunctionResolution::Write().

Function Documentation

void Blowfish_Decrypt ( BLOWFISH_CTX ctx,
uInt32 xl,
uInt32 xr 
)

Definition at line 326 of file blowfish.cc.

References F(), i, N, BLOWFISH_CTX::P, and groupFilesInBlocks::temp.

Referenced by cond::Cipher::bf_process_alloc().

327  {
328  uInt32 Xl;
329  uInt32 Xr;
330  uInt32 temp;
331  short i;
332 
333  Xl = *xl;
334  Xr = *xr;
335 
336  for (i = N + 1; i > 1; --i) {
337  Xl = Xl ^ ctx->P[i];
338  Xr = F(ctx, Xl) ^ Xr;
339  /* Exchange Xl and Xr */
340  temp = Xl;
341  Xl = Xr;
342  Xr = temp;
343  }
344 
345  /* Exchange Xl and Xr */
346  temp = Xl;
347  Xl = Xr;
348  Xr = temp;
349  Xr = Xr ^ ctx->P[1];
350  Xl = Xl ^ ctx->P[0];
351  *xl = Xl;
352  *xr = Xr;
353 }
int i
Definition: DBlmapReader.cc:9
unsigned int uInt32
Definition: blowfish.h:26
uInt32 P[16+2]
Definition: blowfish.h:41
#define N
Definition: blowfish.cc:9
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
void Blowfish_Encrypt ( BLOWFISH_CTX ctx,
uInt32 xl,
uInt32 xr 
)

Definition at line 299 of file blowfish.cc.

References F(), i, N, BLOWFISH_CTX::P, and groupFilesInBlocks::temp.

Referenced by cond::Cipher::bf_process_alloc(), and Blowfish_Init().

300  {
301  uInt32 Xl;
302  uInt32 Xr;
303  uInt32 temp;
304  short i;
305 
306  Xl = *xl;
307  Xr = *xr;
308 
309  for (i = 0; i < N; ++i) {
310  Xl = Xl ^ ctx->P[i];
311  Xr = F(ctx, Xl) ^ Xr;
312  temp = Xl;
313  Xl = Xr;
314  Xr = temp;
315  }
316 
317  temp = Xl;
318  Xl = Xr;
319  Xr = temp;
320  Xr = Xr ^ ctx->P[N];
321  Xl = Xl ^ ctx->P[N + 1];
322  *xl = Xl;
323  *xr = Xr;
324 }
int i
Definition: DBlmapReader.cc:9
unsigned int uInt32
Definition: blowfish.h:26
uInt32 P[16+2]
Definition: blowfish.h:41
#define N
Definition: blowfish.cc:9
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
void Blowfish_Init ( BLOWFISH_CTX ctx,
unsigned char *  key,
int  keyLen 
)

Definition at line 355 of file blowfish.cc.

References Blowfish_Encrypt(), data, i, j, roll_playback::k, N, ORIG_P, ORIG_S, BLOWFISH_CTX::P, and BLOWFISH_CTX::S.

Referenced by cond::Cipher::Cipher().

355  {
356  int i, j, k;
357  uInt32 data, datal, datar;
358 
359  for (i = 0; i < 4; i++) {
360 
361  for (j = 0; j < 256; j++)
362  ctx->S[i][j] = ORIG_S[i][j];
363  }
364 
365  j = 0;
366 
367  for (i = 0; i < N + 2; ++i) {
368  data = 0x00000000;
369 
370  for (k = 0; k < 4; ++k) {
371  data = (data << 8) | key[j];
372  j = j + 1;
373  if (j >= keyLen)
374  j = 0;
375  }
376 
377  ctx->P[i] = ORIG_P[i] ^ data;
378  }
379 
380  datal = 0x00000000;
381  datar = 0x00000000;
382 
383  for (i = 0; i < N + 2; i += 2) {
384  Blowfish_Encrypt(ctx, &datal, &datar);
385  ctx->P[i] = datal;
386  ctx->P[i + 1] = datar;
387  }
388 
389  for (i = 0; i < 4; ++i) {
390 
391  for (j = 0; j < 256; j += 2) {
392  Blowfish_Encrypt(ctx, &datal, &datar);
393  ctx->S[i][j] = datal;
394  ctx->S[i][j + 1] = datar;
395  }
396  }
397 }
int i
Definition: DBlmapReader.cc:9
void Blowfish_Encrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)
Definition: blowfish.cc:299
uInt32 S[4][256]
Definition: blowfish.h:42
static const uInt32 ORIG_S[4][256]
Definition: blowfish.cc:20
unsigned int uInt32
Definition: blowfish.h:26
uInt32 P[16+2]
Definition: blowfish.h:41
int j
Definition: DBlmapReader.cc:9
static const uInt32 ORIG_P[16+2]
Definition: blowfish.cc:12
#define N
Definition: blowfish.cc:9
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
list key
Definition: combine.py:13
uInt32 F ( BLOWFISH_CTX ctx,
uInt32  x 
)
static

Definition at line 281 of file blowfish.cc.

References a, b, EnergyCorrector::c, BLOWFISH_CTX::S, and detailsBasic3DVector::y.

Referenced by Blowfish_Decrypt(), Blowfish_Encrypt(), hitfit::Fourvec_Constraint_Calculator::calculate_constraints(), hitfit::Base_Constrainer::call_constraint_fcn(), TangentCircle::charge(), clangcms::EDMPluginDumper::checkASTDecl(), funct::RatioP1< A, B, Numerical< n > >::combine(), funct::RatioP2< A, B, ProductStruct< C, D > >::combine(), ForwardDiskSectorBuilderFromDet::computeBounds(), ForwardRingDiskBuilderFromDet::computeBounds(), BarrelDetLayer::computeSurface(), ForwardDetLayer::computeSurface(), corrJetEt1(), DAClusterizerInZ::dump(), DAClusterizerInZ_vect::dump(), TrackerValidationVariables::fillHitQuantities(), hitfit::Chisq_Constrainer::fit(), reco::componenthelper::SingleComponent< C, T, F >::get(), reco::componenthelper::MultipleComponents< C, T, F, S >::get(), TKinFitter::getF(), edm::refitem::GetPtrImpl< C, T, F, KEY >::getPtr_(), edm::refitem::GetPtrImpl< C, T, F, unsigned int >::getPtr_(), LayerMeasurements::groupedMeasurements(), HelixBarrelCylinderCrossing::HelixBarrelCylinderCrossing(), MagneticField::inInverseGeV(), TkGluedMeasurementDet::measurements(), LayerMeasurements::measurements(), TkPixelMeasurementDet::measurements(), TkStripMeasurementDet::measurements(), HBHEPulseShapeFlagSetter::PerformNominalFit(), and HcalNoiseMonitor::PerformNominalFit().

281  {
282  unsigned short a, b, c, d;
283  uInt32 y;
284 
285  d = x & 0x00FF;
286  x >>= 8;
287  c = x & 0x00FF;
288  x >>= 8;
289  b = x & 0x00FF;
290  x >>= 8;
291  a = x & 0x00FF;
292 
293  y = ctx->S[0][a] + ctx->S[1][b];
294  y = y ^ ctx->S[2][c];
295  y = y + ctx->S[3][d];
296  return y;
297 }
uInt32 S[4][256]
Definition: blowfish.h:42
unsigned int uInt32
Definition: blowfish.h:26
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
Definition: DDAxes.h:10

Variable Documentation

const uInt32 ORIG_P[16+2]
static
Initial value:
= {
0x243F6A88L, 0x85A308D3L, 0x13198A2EL, 0x03707344L,
0xA4093822L, 0x299F31D0L, 0x082EFA98L, 0xEC4E6C89L,
0x452821E6L, 0x38D01377L, 0xBE5466CFL, 0x34E90C6CL,
0xC0AC29B7L, 0xC97C50DDL, 0x3F84D5B5L, 0xB5470917L,
0x9216D5D9L, 0x8979FB1BL
}

Definition at line 12 of file blowfish.cc.

Referenced by Blowfish_Init().

const uInt32 ORIG_S[4][256]
static

Definition at line 20 of file blowfish.cc.

Referenced by Blowfish_Init().