CMS 3D CMS Logo

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 __assert_no_abort(), GroupedCkfTrajectoryBuilder::advanceOneLayer(), L1TConfigDumper::analyze(), apply(), HcalItemArrayColl< Item, N >::arraySize(), HcalItemArrayCollById< Item, N >::arraySize(), asHepVector(), PFRecHitCaloNavigator< CaloTowerDetId, CaloTowerTopology >::associateNeighbours(), PFRecHitCaloNavigatorWithTime< EEDetId, EcalEndcapTopology >::associateNeighbours(), JetCorrectorParameters::binIndex(), BinLogLikelihoodRatio(), Blowfish_Decrypt(), Blowfish_Encrypt(), Blowfish_Init(), JetMETHLTOfflineSource::bookHistograms(), FWBeamSpotProxyBuilder::build(), SiTrackerMultiRecHitUpdator::calcParameters(), PhysicsTools::LeastSquares::calculate(), FastCircleFit::calculate(), edm::VecArray< std::pair< int, int >, 9 >::capacity(), HGCalDDDConstants::cellHex(), HGCalDDDConstants::cellType(), HGCSiliconDetId::cellX(), HFNoseDetId::cellX(), HGCSiliconDetId::cellY(), HFNoseDetId::cellY(), JetCorrectorParametersHelper::checkMiddleBinUniformity(), RPCSeedOverlapper::CheckOverlap(), clangcms::FiniteMathChecker::checkPreStmt(), popcon::EcalPulseSymmCovariancesHandler::checkPulseSymmCovariance(), dtCalibration::DTVDriftMeanTimer::compute(), SiTrackerMultiRecHitUpdator::ComputeWeight(), ConvertToHist(), SimpleJetCorrector::correctionBin(), tauImpactParameter::ParticleBuilder::createLorentzVectorParticle(), reco::NamedCompositeCandidate::daughter(), reco::CompositeCandidate::daughter(), SingleGaussianState< N >::dimension(), MultiGaussianState< N >::dimension(), dot(), RPCEfficiencySecond::dqmEndJob(), EcalZmassClient::dqmEndJob(), TEveEllipsoidProjectedGL::DrawRhoZ(), EcalPulseSymmCovariance::EcalPulseSymmCovariance(), edm::VecArray< std::pair< int, int >, 9 >::emplace_back(), empty(), DTVDriftCalibration::endJob(), cond::serialization::access< std::pair< T, U > >::equal_(), cond::serialization::access< T[N]>::equal_(), cond::serialization::access< std::array< T, N > >::equal_(), FastCircleFit::FastCircleFit(), cscdqm::Utility::fastHash(), LA_Filler_Fitter::fill(), MuonResiduals1DOFFitter::fit(), MuonResidualsAngleFitter::fit(), MuonResidualsBfieldAngleFitter::fit(), MuonResidualsPositionFitter::fit(), CSCFindPeakTime::fivePoleFitCharge(), fnc_dscb(), fnc_gaussalpha(), fnc_gaussalpha1alpha2(), TopologyWorker::fowo(), ProjectMatrix< T, N, D >::fromH(), HcalItemArrayColl< Item, N >::get(), mathSSE::Vec4< double >::get1(), mathSSE::Vec2< float >::get1(), mathSSE::Vec4< align::Scalar >::get1(), HcalItemArrayCollById< Item, N >::getByIndex(), HGCalParametersFromDD::getCellPosition(), HcalItemArrayCollById< Item, N >::getDefault(), PFEnergyResolution::getEnergyResolutionEm(), fit::RootMinuit< Function >::getErrorMatrix(), edm::getFixedSizeArray(), ReferenceTrajectory::getHitProjectionMatrixT(), GetMEAN(), PhysicsTools::LeastSquares::getMeans(), RPCSeedPattern::getSpecialAlgorithmErrorMatrix(), graph_combine(), h2DSegm::h2DSegm(), h4DSegm::h4DSegm(), magfieldparam::HarmBasis3DCyl::HarmBasis3DCyl(), HistoExists(), magfieldparam::poly2d_base::IncNPwr(), SiTrivialInduceChargeOnStrips::induceVector(), MultiGaussianStateTransform::innerMultiState1D(), DDBase< DDName, std::unique_ptr< DDI::Material > >::isDefined(), HcalItemArrayCollById< Item, N >::isEqual(), mayown_ptr< T, N >::isOwn(), HGCalDDDConstants::isValidHex8(), PerigeeConversions::jacobianCurvilinear2Perigee(), PerigeeConversions::jacobianPerigee2Curvilinear(), PhysicsTools::LeastSquares::load(), HGCalGeomParameters::loadWaferHexagon8(), StripCPEfromTrackAngle::localParameters(), make_array(), PVValHelper::makeLogBins(), mayown_ptr< T, N >::markOwn(), HGCalDDDConstants::maskCell(), edm::EventSelector::maskTriggerResults(), L1TMuonBarrelKalmanAlgo::match(), HGCalDDDConstants::maxCells(), edm::RunningAverage::mean(), MultiGaussianStateTransform::multiState1D(), DTTFBitArray< N >::nBits(), BitArray< 9 >::nBits(), HGCalTopology::neighbors(), JetCorrectorParameters::neighbourBin(), HGCalDDDConstants::numberCellsHexagon(), BitArray< 9 >::nWords(), DTTFBitArray< N >::nWords(), KalmanTrackToTrackCovCalculator< N >::operator()(), TtHadLRSignalSelObservables::operator()(), TtSemiLRSignalSelObservables::operator()(), SaturationFcn::operator()(), CSCThrTurnOnFcn::operator()(), std::hash< std::tuple<> >::operator()(), HcalItemArrayColl< Item, N >::operator==(), MultiGaussianStateTransform::outerMultiState1D(), JetResolution::parameter(), JetResolution::parameterEtaEval(), TopologyWorker::planes_sphe(), TopologyWorker::planes_sphe_wei(), mayown_ptr< T, N >::pointer(), polevlf(), DDHGCalEEAlgo::positionSensitive(), DDHGCalHEAlgo::positionSensitive(), PhiMemoryImage::print(), RecoTauCleanerImpl< Prod >::produce(), CTPPSProtonReconstructionPlotter::profileToRMSGraph(), CTPPSProtonReconstructionSimulationValidator::PlotGroup::profileToRMSGraph(), ProjectMatrix< T, N, D >::project(), ProjectMatrix< T, N, D >::projectAndSubtractFrom(), HcalItemArrayColl< Item, N >::push_back(), edm::VecArray< std::pair< int, int >, 9 >::push_back(), TempTrajectory::pushAux(), cscdqm::Summary::ReadErrorChambers(), cscdqm::Summary::ReadReportingChambersRef(), DTSegmentUpdator::rejectBadHits(), PFMuonAlgo::removeDeadCandidates(), edm::VecArray< std::pair< int, int >, 9 >::resize(), JetResolution::resolution(), EnergyResolutionVsLumi::Resolution(), runlistfromlumifile(), magfieldparam::rz_harm_poly::rz_harm_poly(), magfieldparam::rz_poly::rz_poly(), RZLine::RZLine(), TopologyWorker::sanda(), scalebylumi(), SaturationFcn::set_data(), HcalItemArrayCollById< Item, N >::setDefault(), JetMETHLTOfflineSource::PathInfo::setHistos(), SiPixelDetectorStatus::setNevents(), 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(), JetCorrectorParametersHelper::size(), stat_RMS(), reco::tau::takeNElements(), edm::EventSelector::testSelectionOverlap(), CSCSegment::time(), GsfMatrixTools::trace(), KalmanVertexTrackUpdator< N >::trackRefit(), npstat::transposeBuffer(), HGCSiliconDetId::triggerCellU(), HGCSiliconDetId::triggerCellV(), HGCalTriggerDetId::triggerCellX(), HGCalTriggerDetId::triggerCellY(), SimpleJetCorrectionUncertainty::uncertaintyBin(), mathSSE::Vec2< T >::Vec2(), SurveyOutput::write(), HFunctionResolution::Write(), and math::Graph< Node2, AnotherDummy2 >::~Graph().

Function Documentation

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

Definition at line 326 of file blowfish.cc.

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

Referenced by cond::auth::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 }
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(), mps_fire::i, N, BLOWFISH_CTX::P, and groupFilesInBlocks::temp.

Referenced by cond::auth::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 }
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, mps_fire::i, gen::k, N, ORIG_P, ORIG_S, BLOWFISH_CTX::P, and BLOWFISH_CTX::S.

Referenced by cond::auth::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 }
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 k[5][pyjets_maxn]
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
uInt32 F ( BLOWFISH_CTX ctx,
uInt32  x 
)
static

Definition at line 281 of file blowfish.cc.

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

Referenced by L1TConfigDumper::analyze(), Rivet::HiggsTemplateCrossSections::analyze(), Blowfish_Decrypt(), Blowfish_Encrypt(), HcalHaloAlgo::Calculate(), 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(), compare_key(), ForwardDiskSectorBuilderFromDet::computeBounds(), ForwardRingDiskBuilderFromDet::computeBounds(), BarrelDetLayer::computeSurface(), ForwardDetLayer::computeSurface(), DAClusterizerInZ::dump(), DAClusterizerInZ_vect::dump(), DAClusterizerInZT_vect::dump(), TrackerTreeGenerator::endJob(), hitfit::Fourvec_Constraint_Calculator::eval(), sistripvvi::VVIObjDetails::f2(), TrackerValidationVariables::fillHitQuantities(), ApeEstimator::fillHitVariables(), ApeEstimator::fillTrackVariables(), reco::findMethod(), edm::refitem::findRefItem(), hitfit::Chisq_Constrainer::fit(), reco::componenthelper::SingleComponent< C, T, F >::get(), reco::componenthelper::MultipleComponents< C, T, F, S >::get(), TKinFitter::getF(), edm::refitem::GetRefPtrImpl< C, T, F, KEY >::getRefPtr_(), edm::refitem::GetRefPtrImpl< C, T, F, unsigned int >::getRefPtr_(), LayerMeasurements::groupedMeasurements(), HelixBarrelCylinderCrossing::HelixBarrelCylinderCrossing(), HTXS::HTXSstage1_to_HTXSstage1FineIndex(), HTXS::HTXSstage1_to_index(), MagneticField::inInverseGeV(), TkGluedMeasurementDet::measurements(), LayerMeasurements::measurements(), TkPhase2OTMeasurementDet::measurements(), TkPixelMeasurementDet::measurements(), TkStripMeasurementDet::measurements(), TKinFitter::nbConstraints(), fastsim::HelixTrajectory::nextCrossingTimeC(), std::hash< std::tuple<> >::operator()(), hitfit::operator<<(), HBHEPulseShapeFlagSetter::PerformNominalFit(), edm::soahelper::arg_puller< I, J, Ret, F, Args... >::pull(), ApeEstimator::radialPositionAndError2(), ApeTreeCreateDefault::sectorBuilder(), ApeEstimator::sectorBuilder(), HcalTextCalibrations::setIntervalFor(), RPCCluster::timeRMS(), RPCCluster::yRMS(), hitfit::Constraint_Calculator::~Constraint_Calculator(), and hitfit::Fourvec_Constraint_Calculator::~Fourvec_Constraint_Calculator().

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

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().