CMS 3D CMS Logo

Defines | Functions | Variables

/data/refman/pasoursint/CMSSW_5_3_3/src/CondCore/DBCommon/src/blowfish.cc File Reference

#include "blowfish.h"

Go to the source code of this file.

Defines

#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]

Define Documentation

#define N   16

Definition at line 9 of file blowfish.cc.

Referenced by StripCPEgeometric::WrappedCluster::addSuppressedEdgeStrip(), HcalDetDiagLaserMonitor::analyze(), HLTJetMETDQMSource::analyze(), HcalDetDiagTimingMonitor::analyze(), HcalTimingMonitorModule::analyze(), asHepVector(), HLTJetMETDQMSource::beginRun(), JetMETHLTOfflineSource::beginRun(), JetCorrectorParameters::binIndex(), BinLogLikelihoodRatio(), Blowfish_Decrypt(), Blowfish_Encrypt(), Blowfish_Init(), FWBeamSpotProxyBuilder::build(), PhysicsTools::LeastSquares::calculate(), FourVectorHLTClient::calculateRatio(), StripCPEgeometric::WrappedCluster::centroid(), RPCSeedOverlapper::CheckOverlap(), DTVDriftMeanTimer::compute(), SimpleJetCorrector::correctionBin(), reco::CompositeCandidate::daughter(), reco::NamedCompositeCandidate::daughter(), StripCPEgeometric::WrappedCluster::deformed(), RKSmallVector< Scalar, 5 >::dim(), SingleGaussianState< N >::dimension(), MultiGaussianState< N >::dimension(), RKSmallVector< Scalar, 5 >::dot(), TEveEllipsoidProjectedGL::DrawRhoZ(), StripCPEgeometric::WrappedCluster::dropSmallerEdgeStrip(), DTVDriftCalibration::endJob(), EcalZmassClient::endRun(), RPCEfficiencySecond::endRun(), LA_Filler_Fitter::fill(), MuonResidualsPositionFitter::fit(), MuonResidualsBfieldAngleFitter::fit(), MuonResiduals1DOFFitter::fit(), MuonResidualsAngleFitter::fit(), CalibrationAlgorithm::fitPulse(), CSCFindPeakTime::fivePoleFitCharge(), fnc_dscb(), fnc_gaussalpha(), fnc_gaussalpha1alpha2(), TopologyWorker::fowo(), GraphPath< N, E >::fromTo(), mathSSE::Vec2< TmpType >::get1(), mathSSE::Vec4< align::Scalar >::get1(), mathSSE::Vec4< double >::get1(), PFEnergyResolution::getEnergyResolutionEm(), fit::RootMinuit< Function >::getErrorMatrix(), ReferenceTrajectory::getHitProjectionMatrixT(), GetMEAN(), PhysicsTools::LeastSquares::getMeans(), RPCSeedPattern::getSpecialAlgorithmErrorMatrix(), graph_combine(), magfieldparam::HarmBasis3DCyl::HarmBasis3DCyl(), HistoExists(), magfieldparam::poly2d_base::IncNPwr(), RKSmallVector< Scalar, 5 >::increment(), ThePEG::HepMCConverter< HepMCEventT, Traits >::init(), MultiGaussianStateTransform::innerMultiState1D(), SimpleJetCorrector::invert(), DDBase< DDName, DDRotationMatrix * >::isDefined(), PerigeeConversions::jacobianCurvilinear2Perigee(), PerigeeConversions::jacobianPerigee2Curvilinear(), edm::EventSelector::maskTriggerResults(), StripCPEgeometric::WrappedCluster::maxProjection(), StripCPEgeometric::WrappedCluster::middle(), MultiGaussianStateTransform::multiState1D(), DTTFBitArray< N >::nBits(), BitArray< 9 >::nBits(), JetCorrectorParameters::neighbourBin(), BitArray< 9 >::nWords(), DTTFBitArray< N >::nWords(), TtSemiLRSignalSelObservables::operator()(), ROOT::Math::CholeskyDecompHelpers::_solver< F, N, V >::operator()(), KalmanTrackToTrackCovCalculator< N >::operator()(), TtHadLRSignalSelObservables::operator()(), ROOT::Math::CholeskyDecompHelpers::_inverter< F, N, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_decomposer< F, N, M >::operator()(), SaturationFcn::operator()(), CSCThrTurnOnFcn::operator()(), operator*(), RKSmallVector< Scalar, 5 >::operator*=(), operator+(), RKSmallVector< Scalar, 5 >::operator+=(), operator-(), RKSmallVector< Scalar, 5 >::operator-(), RKSmallVector< Scalar, 5 >::operator-=(), operator/(), RKSmallVector< Scalar, 5 >::operator/=(), operator<<(), MultiGaussianStateTransform::outerMultiState1D(), PFClusterAlgo::parameter(), TopologyWorker::planes_sphe(), TopologyWorker::planes_sphe_wei(), ProjectMatrix< T, N, D >::project(), ProjectMatrix< T, N, D >::projectAndSubtractFrom(), cscdqm::Summary::ReadErrorChambers(), cscdqm::Summary::ReadReportingChambersRef(), DTSegmentUpdator::rejectBadHits(), hitfit::LeptonTranslatorBase< AElectron >::resolution(), RKSmallVector< Scalar, 5 >::RKSmallVector(), 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(), BTagHLTOfflineSource::PathInfo::setHistos(), CosmicMuonGenerator::setNumberOfEvents(), function::ZMuTrackFunction::setParameters(), function::ZMuStandaloneScaledFunction::setParameters(), function::ZMuTrackScaledFunction::setParameters(), CosmicMuonGenerator::setRanSeed(), magfieldparam::poly2d_base::SetTabSize(), magfieldparam::rz_harm_poly::SetTrigArrSize(), MonitorElement::ShiftFillLast(), cscdqm::Utility::SignificanceLevelHigh(), RKSmallVector< Scalar, 5 >::size(), stat_RMS(), StripCPEgeometric::WrappedCluster::sumQ(), reco::tau::takeNElements(), edm::EventSelector::testSelectionOverlap(), CSCSegment::time(), GsfMatrixTools::trace(), KalmanVertexTrackUpdator< 5 >::trackRefit(), SimpleJetCorrectionUncertainty::uncertaintyBin(), HFunctionResolution::Write(), and SurveyOutput::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().

     {
  uInt32  Xl;
  uInt32  Xr;
  uInt32  temp;
  short       i;

  Xl = *xl;
  Xr = *xr;

  for (i = N + 1; i > 1; --i) {
    Xl = Xl ^ ctx->P[i];
    Xr = F(ctx, Xl) ^ Xr;
    /* Exchange Xl and Xr */
    temp = Xl;
    Xl = Xr;
    Xr = temp;
  }

  /* Exchange Xl and Xr */
  temp = Xl;
  Xl = Xr;
  Xr = temp;
  Xr = Xr ^ ctx->P[1];
  Xl = Xl ^ ctx->P[0];
  *xl = Xl;
  *xr = Xr;
}
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().

     {
  uInt32  Xl;
  uInt32  Xr;
  uInt32  temp;
  short       i;

  Xl = *xl;
  Xr = *xr;

  for (i = 0; i < N; ++i) {
    Xl = Xl ^ ctx->P[i];
    Xr = F(ctx, Xl) ^ Xr;
    temp = Xl;
    Xl = Xr;
    Xr = temp;
  }

  temp = Xl;
  Xl = Xr;
  Xr = temp;
  Xr = Xr ^ ctx->P[N];
  Xl = Xl ^ ctx->P[N + 1];
  *xl = Xl;
  *xr = Xr;
}
void Blowfish_Init ( BLOWFISH_CTX ctx,
unsigned char *  key,
int  keyLen 
)

Definition at line 355 of file blowfish.cc.

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

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

                                                                      {
  int i, j, k;
  uInt32 data, datal, datar;

  for (i = 0; i < 4; i++) {

    for (j = 0; j < 256; j++)
      ctx->S[i][j] = ORIG_S[i][j];
  }

  j = 0;

  for (i = 0; i < N + 2; ++i) {
    data = 0x00000000;

    for (k = 0; k < 4; ++k) {
      data = (data << 8) | key[j];
      j = j + 1;
      if (j >= keyLen)
        j = 0;
    }

    ctx->P[i] = ORIG_P[i] ^ data;
  }

  datal = 0x00000000;
  datar = 0x00000000;

  for (i = 0; i < N + 2; i += 2) {
    Blowfish_Encrypt(ctx, &datal, &datar);
    ctx->P[i] = datal;
    ctx->P[i + 1] = datar;
  }

  for (i = 0; i < 4; ++i) {

    for (j = 0; j < 256; j += 2) {
      Blowfish_Encrypt(ctx, &datal, &datar);
      ctx->S[i][j] = datal;
      ctx->S[i][j + 1] = datar;
    }
  }
}
uInt32 F ( BLOWFISH_CTX ctx,
uInt32  x 
) [static]

Definition at line 281 of file blowfish.cc.

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

Referenced by GeometricSearchDetMeasurements::addInvalidMeas(), Blowfish_Decrypt(), Blowfish_Encrypt(), hitfit::Fourvec_Constraint_Calculator::calculate_constraints(), hitfit::Base_Constrainer::call_constraint_fcn(), TangentCircle::charge(), funct::Product< PROD_S(F, G), H >::combine(), funct::RatioP1< F, G, H >::combine(), funct::RatioP2< F, G, H >::combine(), funct::SimplSumOrd< A, B, PROD_S(C, D) >::combine(), NavVolume6Faces::computeBounds(), BarrelDetLayer::computeSurface(), ForwardDetLayer::computeSurface(), corrJetEt1(), ThreadSingleton< T, F >::factory(), TkPixelMeasurementDet::fastMeasurements(), TkStripMeasurementDet::fastMeasurements(), TkGluedMeasurementDet::fastMeasurements(), TrackerValidationVariables::fillHitQuantities(), hitfit::Chisq_Constrainer::fit(), reco::componenthelper::SingleComponent< C, T, F >::get(), reco::componenthelper::MultipleComponents< C, T, F, S >::get(), NonPropagatingDetMeasurements::get(), TKinFitter::getF(), edm::refitem::GetPtrImpl< C, T, F, KEY >::getPtr_(), HelixBarrelCylinderCrossing::HelixBarrelCylinderCrossing(), MagneticField::inInverseGeV(), ROOT::Math::CholeskyDecompHelpers::_inverter< F, 5, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_inverter< F, 2, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_inverter< F, 3, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_solver< F, N, V >::operator()(), ROOT::Math::CholeskyDecompHelpers::_decomposer< F, 1, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_solver< F, 4, V >::operator()(), ROOT::Math::CholeskyDecompHelpers::_decomposer< F, 3, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_solver< F, 5, V >::operator()(), ROOT::Math::CholeskyDecompHelpers::_inverter< F, N, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_decomposer< F, 2, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_decomposer< F, 5, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_solver< F, 2, V >::operator()(), ROOT::Math::CholeskyDecompHelpers::_decomposer< F, N, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_solver< F, 3, V >::operator()(), ROOT::Math::CholeskyDecompHelpers::_decomposer< F, 4, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_inverter< F, 6, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_decomposer< F, 6, M >::operator()(), ROOT::Math::CholeskyDecompHelpers::_solver< F, 6, V >::operator()(), ROOT::Math::CholeskyDecompHelpers::_inverter< F, 4, M >::operator()(), HcalNoiseMonitor::PerformNominalFit(), and HBHEPulseShapeFlagSetter::PerformNominalFit().

                                      {
   unsigned short a, b, c, d;
   uInt32  y;

   d = x & 0x00FF;
   x >>= 8;
   c = x & 0x00FF;
   x >>= 8;
   b = x & 0x00FF;
   x >>= 8;
   a = x & 0x00FF;

   y = ctx->S[0][a] + ctx->S[1][b];
   y = y ^ ctx->S[2][c];
   y = y + ctx->S[3][d];
   return y;
}

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