Jump to content

User:Gezzer898/sandbox

From Wikipedia, the free encyclopedia

Cryptanalysis

[edit]

The Baum-Welch algorithm is often used to estimate the parameters of HMMs in deciphering hidden or noisy information and consequently is often used in Cryptanalysis. In data security an observer would like to extract information from a data stream without knowing all the parameters of the transmission. This can involve reverse engineering a channel encoder.[1] HMMs and as a consequence the Baum-Welch algorithm have also been used to identify spoken phrases in encrypted VoIP calls.[2] In addition HMM cryptanalysis is an important tool for automated investigations of cache-timing data. It allows for the automatic discovery of critical algorithm state, for example key values.[3]

Description

[edit]

A Hidden Markov Model describes the joint probability of a collection of 'hidden' and observed discrete random variables. It relies on the assumption that the hidden variable given the hidden variable is independent of previous hidden variables and the current observation variables depend only on the current hidden state.

The Baum-Welch algorithm uses the well known EM algorithm to find the maximum likelihood estimate of the parameters of a hidden Markov model given a set of observed feature vectors.

Let be a discrete hidden random variable with possible values. We assume the is independent of time . We can present this information as a time independent stochastic transition matrix

The initial state distribution (i.e. when ) is given by
The observation variables can take one of possible values. The probability of a certain observation vector at time for state is given by: is a by matrix.

An observation sequence is given by

Thus we can describe a hidden Markov chain by . The Baum-Welch algorithm finds . (i.e. the HMM parameters that maximise the probability of the observation.)

Algorithm

[edit]

Set with random initial conditions. They can also be set using prior information about the parameters if it is available.

Forward Procedure

[edit]

Let , the probability of seeing the and being in state at time . This is found recursively:

Backward Procedure

[edit]

Let that is the probability of the ending partial sequence given starting state and time . We calculate as,

Update

[edit]

We can now calculate the temporary variables:

which is the probability of being in state at time given the observed sequence and the parameters

which is the probability of being in state and at times and respectively given the observed sequence and parameters .

can now be updated:

which is the expected frequency spent in state at time .

which is the expected number of transitions from state i to state j compared to the expected total number of transitions away from state i.

where is an indicator function and is the expected number of times the output observations have been equal to while in state over the expected total number of times in state .
These steps are now repeated iteratively until a desired level of convergence.
Note: It is possible to over-fit a particular data set. That is . The algorithm also does not guarantee a global maximum

Example

[edit]

Suppose we have a chicken from which we collect eggs at noon everyday. Now whether or not the chicken has laid eggs for collection depends on some unknown factors that are hidden. We can however (for simplicity) assume that there are only two states that determine whether the chicken lays eggs. Now we don't know the state at the initial starting point, we don't know the transition probabilities between the two states and we don't know the probability that the chicken lays an egg given a particular state. To start we first guess the transition and emission matrices.

Transition
State 1 State 2
State 1 0.5 0.5
State 2 0.3 0.7
Emission
No Eggs Eggs
State 1 0.3 0.7
State 2 0.8 0.2
Initial
State 1 0.2
State 2 0.8


We then take set of observations (E = eggs, N = no eggs): NN, NN, NN, NN, NE, EE, EN, NN, NN
The next step is to estimate a new transition matrix.

Observed sequence Probability of sequence and state is S1 then S2 Highest Probability of observing that sequence
NN 0.024 0.3584 S2,S2
NN 0.024 0.3584 S2,S2
NN 0.024 0.3584 S2,S2
NN 0.024 0.3584 S2,S2
NE 0.006 0.1344 S2,S1
EE 0.014 0.049 S1,S1
EN 0.056 0.056 S1,S2
NN 0.024 0.3584 S2,S2
NN 0.024 0.3584 S2,S2
Total 0.22 2.3898


Thus the new estimate for the S1 to S2 transition is now . We then calculate the S2 to S1, S2 to S2 and S1 to S1 transition probabilities and normalize so they add to 1. This gives us the updated transition matrix.
Next, we want to estimate a new emission matrix,

Observed Sequence Highest probability of observing that sequence if E is assumed to come from S1 Highest Probability of observing that sequence
NE 0.006 S2,S1 0.1344 S2,S1
EE 0.014 S1,S1 0.049 S1,S1
EN 0.056 S1,S2 0.056 S1,S2


This allows us to calculate the emission matrix as described above in the algorithm, by adding up the probabilities for the respective observed sequences. We then repeat for if N came from S1 and for if N and E came from S2 and normalize.
To estimate the initial probabilities we assume all sequences start with the hidden state S1 and calculate the highest probability and then repeat for S2. Again we then normalize to give an updated initial vector.
Finally we repeat these steps until the resulting probabilities converge satisfactorily.

  1. ^ Dingel, Janis (24). "Parameter Estimation of a Convolutional Encoder from Noisy Observations". IEEE International Symposium on Information Theory. {{cite journal}}: Check date values in: |date= and |year= / |date= mismatch (help); Unknown parameter |coauthors= ignored (|author= suggested) (help); Unknown parameter |month= ignored (help)
  2. ^ Wright, Charles; Ballard, Lucas; Coull, Scott; Monrose, Fabian; Masson, Gerald (2008). "Spot me if you can: Uncovering spoken phrases in encrypted VoIP conversations". IEEE International Symposium on Security and Privacy.
  3. ^ Brumley, Billy Bob; Hakala, Risto M. (2009). "Cache-Timing Template Attacks". Advances in Cryptography. Lecture Notes in Computer Science. 5912: 667-684. doi:10.1007/978-3-642-10366-7_39. ISBN 978-3-642-10365-0. Retrieved 21 October 2013.{{cite journal}}: CS1 maint: date and year (link)