Okay folks, what should have started on Tuesday's lecture with the program crashed in the last 15 minutes so we don't have the last 15 minutes of lecture on Tuesday, so good for you for coming in-person. I can see at least some familiar faces so you came to bulk, good for you. I don't know what's to happen, so, luckily the whole thing didn't crash. I was slightly worried about that when we left. Let's see, bad news, good news. Nobody coming to office hours? Have you come and started yet? People came to our office hours. Okay, people came to your office hours. Just, I'm very scared. Okay, we don't have to answer if you can think about it. Okay, well, I'll tell you, we had a very good success story yesterday where somebody came in and was only able to compile their project and I was able to help them fix just two minor bugs and then bang, all the test cases passed. So that was, I think that only took about 15 or 20 minutes. I only had two people yesterday, which is why I was slightly worried that either not a few people are starting early enough or, I don't know, you're getting help elsewhere, which is good, so I'm not worried about that, but anyways, don't feel free to come to my office hours. I was just me sitting in there, I don't know, reading or something. Cool, so let's break some cyber attacks. All right, so we have some cyber attacks up here. What is, so, what are the two ciphers we've talked about so far? Caesar hasn't seen the time of work? I should have seen what? Yeah, shifting the letters by the amount that the key specifies, and then to decrypt, you shift back, okay? Then what about the second cipher that we've been talking about? Yeah, visionary cipher, and what's the difference there? How does the visionary cipher work?   Okay, yeah, so it's a multi-length key, right? And then each key shifts that alphabet by that amount, so one key would shift it by, so for a, we saw the example, we'll go back a little bit, we saw the example with a three-letter key, so we saw a three-letter key big, we have a message, the boy has the ball, and then by shifting each letter of the plain text by the amount that the key specifies, he's now essentially shifted every third character by a different Caesar cipher amount. Cool, okay. So we have this key, we need to know what we want to try to understand. So first, so we have, we've talked about many general techniques to try to attack the cipher. What do we need to try to determine first? The key length. The key length, why is the key length important? If it's small enough, you can brute force the key. If it's small enough that we can brute force it, like how small? Depends how fast you can check. Depends how fast you can check, yes, but. So yeah, because one, we know that that's pretty easy, it could be more and greater if we assume something that's probably harder to have to counter to force, we still need to know, yeah. You can determine the interval that the different ciphers are on, so that if you see where it is, you can tell if it's actually the same sequence of letters, or if it may be just the code, or. Yeah, so let's think about that. So first, what we need to be able to, going back to what you're saying, we need to be able to split up this plain text into different alphabets that are all, alphabets is encrypted with the same cipher, the same Caesar cipher. If we don't have that, we are essentially shooting in the dark, we can't really ever solve this. So, going back to our original example, what were some interesting patterns that we saw that still made it through the encryption process into the cipher text? Yeah, the is encoded twice as OPK, and even more TAPD is encoded as OPKW. And we talk about that, this is because it just so happens that those characters in the plain text were repeated, and they were exactly the amount of the key off, so the exact same parts of the key were over those same characters. Cool, so how does that help us then uncover and try to determine the period of the key? Yeah, so we know that the key, so we know the distance between TIG and the cipher text is, we'll see, one, two, three, four, five, six, seven, eight, so nine, there's nine difference between the repetitions, so we know that the key must either be nine or some divisor of nine, right? So it could be, yeah, so it could be, it's three in this case, we know exactly what it is, but this tells us it's very likely. So what should we probably do here? Where are the repetitions, anybody remember? EQOOG, and the O before it. And the O before it is repeated O, E, Q, O, G. Yeah, so that's a pretty good difference. That is, let's see, I think these are groups of five, so that's five, 10, 15, 20, 25, 30, so 30 apart. Any others? MOC. MOC feels like a massive course just without the online part. MOC, and where's the other one? There we go, awesome. We can count that, what is that, that's five, 10, 15, 20, 25, 30, 30, 40, 25, 50, 55, 60, 65, 72? All right, I have it on another slide. We'll just say it's some length. You can count it later. Any others? Could you write a program to do this? Not probably, the answer should be yes. You can write a program to do this, right?  And so this is basically exactly what we talked about, that repetitions in the ciphertext occur when the characters of the key appear over the same characters in the plaintext. And this can happen for a lot of reasons, like we saw with common words like bub, repeated often in the plaintext, it's highly likely that those, and then it's more likely that the key will go over them. But yeah, so we already saw this here. So we know that in this case, or I guess I should say we don't know for certain because again, this could just be due to chance. It's possible that this just happens randomly. So we have that the difference is nine, so the period is a factor of nine. It could be one, it could be three, or it could be nine. Right, we could easily, how could we easily check if it was one? Yeah, if the key is length one, what does that mean? It's a Caesar cipher, so we can break that using all this other incongruity. Your frequency analysis, we can just brute force all possible keys. Awesome. Okay, so we can look at this in here. You can stare at this for a long time, you can write a program to do this, and you could do all of the, so we can also do all of the two character repetitions, not just three, so we can do two character, three character, and as many as we can. And we'll get a ton of them. So we have M-I-O-O, distance 10 and five, O-E-Q-O-O-G, which is distance 30, as we said, where was the move, it was 72. Yeah, look at that, I can count. So it could be, 72 is kind of a lot, it could be six, it could be any kind of these factors and combinations, let's see. So, let's think for a minute like this one, Q-O. The factors are seven and seven, compare that one to all the other ones. Probably unlikely, right, so this is probably one that just happened by chance, because what does it make sense that everything else is telling us it's either something with five or two or three, but this says well it must be at least seven, that's highly unlikely, so we can probably rule this out as a, so we can probably rule this out as maybe like a serious result. What should give us the most confidence that it actually occurred because of repetitions in the key and the point test? So were there two moments during that? The long one, yeah, look at the longest string first. Right, again, it's important, not the distance, the distance doesn't matter, right, such as how far apart they are, but how long the repetition is. So this is the longest one, O-E, O-E-Q-U-G. So we can start there, and we need to look and say okay it's 30, so the factors are two, three, and five, which could mean it's either, is any of those comments, so it could be one, two, three, five, six, 10, 15, or 30. Do we just try all of those? I don't know, what would your intuition be at this point? Three. Could be three, what else? Yeah, six. What can we use to maybe validate those hypotheses? We can look and see what of those makes sense with all the other ones, right? So we have two, three, five, is it probably not 30, that seems kind of crazy, like to use a key of like 30 with a, what was there, about 150 characters or something? Okay, so now let's look, let's see, okay. So we were looking at and considering, so we're not gonna, are we gonna consider one? No, it kind of seems silly, right? We could just test that, pretend it's a seizure type or break it that way. So we were looking at two, so we say three and six, are those what we said? Yeah, keep this hearing it, okay. Maybe five, so one, two, three, five, six. So let's think for a minute, okay. So if it was, okay, one, we're gonna rule out immediately. Two, all right, can we rule out two? Yeah. Because you have that larger sequence, do you like weigh it every minute, by saying that maybe that's more valid because it is a lot of longer sequence? Yes, so that's why we're starting with that sequence and we're doing all of the multiples here. So that's why we got the one, two, three, five, six. I think it was 10, 15 and 30. So we're gonna start with those as our possible set, we'll window that down a little bit and then we'll try to see which of these matches up most with the rest of them, right? Knowing that it can be serious or it could be not serious. So let's think of things maybe that we can rule out. What about five? Like two and three are factors of a lot of them, but five is? Yeah, so two, we'll get two, right? Two is a factor of a lot of them, actually. Almost all. Three is a factor of not all of them, but more, right, three, three, three, three, three, three. And we can also wait, with our waiting, we can wait at MOC heavier than the other ones, right? So we can see, okay, it's in here, that's good. What about five? Five is in two, only in two of them? Three, well, three including this one, but that's why we have it up here, right? So it's in the longest one, but the only other time five appears is in MI and OO. So we can probably say, well, we can maybe ignore five. What about six? Six. And five of them? Three, one, two, three, four, five, six. Six of them, including both of our six. So what do we think? Yeah. So four is? Yeah, four is not in the divisor of 30, so that's what we're, we've listed all the divisors of 30, we put it down on the other slide. And so we copied all of the smaller ones. So we kind of got rid of 10 and 15 and 30, saying those are probably pretty big, we can check those later if we need to. And we also maybe rule those out here, because we looked at five and we said, well, five only appears in three of them. So let's give it a five, but if you give it a five, you have the area of 10 and 15. And after that, OO has five, and then along the one, OO is the sub-stream of it, does that have, tell us anything? That is a, I think the answer is no, because that's a different repetition. So it's included, it starts at 22, which is actually before this, and goes to, and the next repetition is at 27. So it's not, yeah, we wouldn't use a subset of the same one because that doesn't give you more information. Yeah. I just want to make sure I don't follow up correctly. We haven't eliminated four as a possibility. We're just trying to identify what's probable what to throw our resources at, right? We've eliminated four because it's not a divisor of 30. So we're only looking at all the numbers that divide 30 easily, because those are what the key length could be, which makes sense with the largest. So that's why we're starting with one, two, three, five, six, 10, 15, and 13. Does that make sense? Like a key length, if the key length was four. The longest cycle, repeating cycle text is the highest probability of not being a chance. Exactly. Okay, yes. And so therefore we're gonna be confident in eliminating. Yes, and again, but it could be serious. Maybe only four of them match instead of five characters, and the first one would just do the chance. But we have limited resources. Exactly, so we're gonna, we're trying to, exactly, we're trying to. Narrow down and limit what our guesses are gonna be for the period, and we'll have different checks later to try to check roughly how right we're with it. Which again, we'll also be due to statistics, there'll be some error there, so it's a, you know, this is a, you're breaking cryptography, it's a little bit of a guess and check, I'm saying how you're going, yeah. Just because you've used it four times, spurious means suspicious, what was your name? Spurious means due to chance. So it's not related because, it's not because of the, so I don't want to move away from the slide because I'm not ruining all of my great writing here. But it means that the repetitions in the cyber text are not because the key was over the plain text, so the key was over the exact same letters of the plain text. It just happens due to chance. Questions on this side?  You have to be over here to write. I don't, not like you. Okay, all right. So we have, we eliminated five, so we can maybe rule out some of these that have, well two, we can't rule out, eh. So we look at this, we have two and three, two is in a lot of places, three is in a lot of places, and six, the combination of them is in a good amount of places, what do we have? So this one, this one, this one, this one, this one, this one, four, five, six, six, including both of our largest, also have six in them. I'd say it's probably a good bet to try that one first. If we have a strong argument for not doing that. I was curious, would you want to lean towards a longer amount or a larger amount or not in general? Cause if there's like a lot of characters, wouldn't it make sense that he wouldn't really only be like two or is that, assuming? Yeah, I mean, you'd use your intuition of the problem and I mean, if you want to meditate game it, if this was an assignment too, you'd also want to be like, well, a two-character string is probably not that interesting, like a two-character key because that can be trivially brute-forced and so it's probably something longer-ish and we saw all of the key space that we did on Tuesday, right, of all the different sizes, so yeah, I think you factor that into your guessing first. Yeah, wouldn't using the larger ones first anyway or the larger multiples of the smaller ones first anyway, be better in general because the smaller ones would be substrings of that key, so it would be captured by. Yeah, yeah, yeah, so okay, this is good. Actually, this happened a lot last semester, so you could consider this key a nine-character key that is V-I-G, V-I-G, V-I-G or you could consider it a six-character string that's V-I-G, V-I-G or a three-character string that's just V-I-G, V-I-G. So yeah, in a big case like this, you'd want to try maybe the largest number because that will at least tell you if you're wrong immediately, so okay, let's put it this way, it was a three-character key and we treated it like a six-character key, we would see that the key was the same thing repeating and so there we solved it and we figured out the key. Okay, so we're already, yeah, so we kind of, this was our kind of reasoning that we did, we could also look at it and how many of them have twos in their factors, how many have threes, so maybe we try six first. But we want to check, so how can we check? So we have this, how do we check that six is correct? Yeah, so we looked at the frequency of this whole text of all the characters, we could see something that was closer to uniform, because all the frequencies get all mixed up and put together, but if we split this into alphabets where every six characters in its own alphabet and we graph and we think about the frequencies there, each of those should approximate English, right? The problem that we have is now we have, we talk about the sample side, we'll only sample it from the six to the size of our ciphertext now so the noise gets a little bit higher, but yeah, that's essentially the idea is we can look at, split this up and try to run some, we can use the same statistical measures we did before, I'll show you a different statistical measure so this is just showing you different types of ways to check is this text that I am looking at, is it English text but shifted? So we can use, and this is not to say that this is a better or worse way, so we could do the, essentially the frequency analysis. So we could do our statistical frequency analysis and determine, oh wait, that's not true, this is the correct shift, we could use that later. Sorry, we're gonna use a different measure, okay. We're gonna use the index of coincidence which is the probability that two randomly chosen letters from the ciphertext will be the same. So think about English, this is kind of, in some sense, one measure that we'll look at and try to see how English ish is this text. So for instance, if you, let's see, if you randomly, let's look at the math and then we'll go back, yeah, okay. So have you taken statistics yet? You got like a yes and a no's, something? You know something about probabilities, right? Okay, me too. So the index of coincidence, we're gonna do, so it's essentially a, we're gonna, what is the probability that we choose two characters from whatever, ciphertext, anything, you think it involves? We're gonna choose two things, what's the probability that they're the same? Yeah, so the probability of the first, so the probability that it is that character and then the probability of what's left, that it is that character, let's see if that's right. Yep, okay, cool. So we'll use this, we'll call this, fi is the frequency of character i. So we can do this for, well, so we have fi, okay, cool. So we have fi is the frequency of that character, so just how many of that character appears in our ciphertext? So if I wanted to know for a, what's the probability of getting a? I could say, well, it's the frequency of a times the frequency of a minus one. But I need to divide that by what? So I want the probability. So the frequency here we're just saying is the count, like how many there are. Divide by n for the f a and n minus one for f a minus one. Times n minus one, everyone agree? So this is the probability that I picked two letters for my ciphertext and they're both a's. What if I wanted to calculate that probability for every single letter in the alphabet?  I'm just going to call this ic. So I want to calculate this for all letters of the alphabet, right? So I could do, I'm going to stop doing it like that. Times a minus one, divided by n times n minus one. And I'm going to add to this f of b times what? F of b minus one over n times n minus one. Don't need to keep writing this, because I'm running out of room. Okay, so I'm going to dot, dot, dot that. And I can do something a little bit nicer. I can say this is the sum of, we'll turn these into numbers now. It doesn't really matter. We can say zero is less than equal to i, which is less than equal to 25, 25 characters. So for all 25 characters, we're going to do the f of i times the f of i minus one. So the frequency of that specific character times the frequency of that character minus one, divided by n times n plus n minus one. Everyone agree? And we can simplify this a little bit further. Yeah, we can take out the n's, because they don't have anything to do with the summation, right? You can think about it up here. We could factor out this and just multiply all the summation of all of these by one over n times n minus one. We'll just clean it up a little bit, n minus n minus one. So here we have it, and this is all just based on counting, right? There's nothing special that we're having here. n is just the size of the ciphertext. And each f of i is the number of each of those letters in your ciphertext. So this n, so this is kind of one statistical measure that tries to get at what's the aggregate multiple occurrences of characters in a certain ciphertext, in actually any text. So you can apply this measure to English. And does this matter about shifting? So does shifting affect this? Right, so if I have a's in my plain text and I shift those all to z's, does this measure care about that? No, because it's summing up over all the letters. It doesn't care which letter is which, which makes it perfect for using on our ciphertext. So essentially, what you can think of what we're gonna do is use this measure. We, people have pre-calculated this measure for English text. So we can use this measure in multiple ways. A, we can use it to actually split up our language in the number of alphabets. We can calculate the index of the coincidence for each of those and see if it gets close to English. If it does, that means those are all in the same thing. We can also do what we talked about earlier and look at the frequency analysis. So we can look at the graph, compare that with English to see how close we are. Okay, so we can do exactly that. So this is, so now we've split our ciphertext into six different alphabets and we're just gonna calculate the index of coincidence for each of those. Yes. You said that there are pre-calculated values for English, what is, what are those? Yes. I don't wanna get into too much. 0.066 for right now. We'll come back to this in a second. So, and again, remember the important thing to think about here, and again, this is a statistical measure. So here we have what, four, 22 characters. And so we're only on 22 characters. So these may vary depending on what happens. Let's bring it up into six. So we have 0.069, 0.078, 0.056, 0.124, and 0.043. So which ones of these are roughly around 0.066? First one's pretty good. Second one? Yeah, I mean pretty good, just close. The third one? Yeah, pretty good. What about this one? No. And this one? Pretty far away. I don't know, what are we gonna think of? We actually are pretty good, right? If they're all layoff, we would know that this was probably just random. We messed up our period, we'd go back, double check that. And the other cool thing about the index of coincidence is that you can calculate it for different periods. So you can, and maybe this helps us more when considering if those things match or not. So you can calculate it for a period of one, which is essentially no English text. You can also, they've pre-calculated this for different periods of, and you can see as essentially as you get closer, as the period gets higher and higher, it gets closer to one over 26. The probability is equally likely for every character that you poll one and you poll, it's just random. So it's not based on any distribution, so the characters are essentially random. So this is another way we could actually check. We could double check in multiple ways. We can compute, so for our cyber text, the index of coincidence is 0.043, which is in between, it's like a little bit above five, but you can see if these measures are very close to each other. So this is why you need to keep double checking. So it indicates a key may be slightly larger than five. But this is, again, now we're double checking our previous estimate, so this had nothing to do with repetitions or anything, right? So you can think of them as independently coming to the same conclusion using two different methods, that the key is likely to be six, based on just computing this value and our analysis of the repetitions, and then our double check analysis of looking at the index of coincidence for each of these alphabets. Questions? Yeah. Why did you, when you said it could be larger than five, did that mean you were just, because you were testing the value of five, is that why? It is looking at this, so sorry, we're gonna have to go back and forth a little bit, oh, sorry. Okay, so our index of coincidence is 0.043 in that cyber test. And then looking at here, 0.043, at least for the numbers that we have here, is somewhere between five and 10. But it's not gonna be an exact estimate, and especially with the difference between four and five being 0.001. We're pretty small deltas, so we use this as kind of ballpark, are we roughly where we think we are? So now what do we do? Yeah, each of them likes Caesar ciphers. So I kinda mentioned this on Tuesday, but let's think. Should we just brute force each of these ones because we know they're a different key? We can brute force this, try all 26 combinations, but how do we know when we're right? It makes sense? Yes, so that's how we did it for the cyber text or sort of for the Caesar cipher, right? We took this value here and we shifted all 26 values until we read it. But the key difference was the letters in this album that are all the every six letter of the cyber test. So maybe the better way to read this would be something like this. So rather than thinking about, where are you? Pacing, the most difficult thing. Okay, so rather than thinking about it like this, which is kind of where we're thinking and where we think brute forcing may help us, what we really have to be thinking about each of these alphabets is something like this. What did I do to this? Yeah, I left space for all the other letters, right? So all the other letters from all the other alphabets, right? So this is the very first letter of our cyber text. The next character is D-Q-Y-S-M and I left those as underscores and then we have I. So if we tried to brute force this, we could generate all possible 26 values of this. But how do we know when we're right? Because we're missing those other five characters that give us a context solution between all those other three languages. So what do we do? Yeah, now with the key thing to think about is all of these, we have six alphabets, but they're intertwined with each other, right? They're not like previously, where a seizure cypher was just one plain text encrypted and we can easily just brute force decrypt it, right? So we need to make educated guesses about each of the cypher's, maybe shift them and then start thinking about putting them together and trying to make, essentially they're gonna guess and check, so trying to figure out, okay, well I think this alphabet is shifted by this amount and I think this other alphabet is shifted by this amount, then when I put them together, maybe I can find words. I can find things like the and that would help me break the next alphabet and I could try that shift. But I may be wrong, so I may have to go back and it's just like, you guys do puzzles, it's a doku and stuff, right? Sometimes I have to guess what is in a specific box and then you see if that leads you to a contradiction then you go back and change that and hopefully do it in pencil and not pen. Cool, so this is gonna be our plan. We're going to use the techniques for Caesar cypher, but we basically, it's not that we can't use brute force, but that if we were really to brute force this, you have to brute force all of that together, which is the same as trying to break the six character key, which means you're gonna have to guess a lot. All right, but I'm gonna show you. So we can do exactly what we did before, we can calculate this statistical analysis, we can calculate the frequency of each of the shifts to see which gets us closer to this graph, which is exactly what we did before. Instead of just doing exactly what we did before, I'm gonna show you a different technique that we could use, that's a little bit more granular to try and do this. So the idea is this graph is great, right? Because it's a literal distribution of English characters, but it's a bit much in terms of information and it's kind of hard even if you remember when we were breaking that Caesar cypher of exactly what shift was what based on the frequencies. So a different way to approach even this problem in a single Caesar cypher, but also here in a Vigenere cypher, is what we're going to do is count up. So we're gonna take all the letters, put it on A through Z and then for each alphabet, we're just gonna count up how many of each character appears in there. Those are just pretty similar, we're just literally counting in the first cypher text, there are three A's, one B, zero C, zero D, four zero, one one and so on all the way through. And we just do this for each of the cypher texts, this is not all of our alphabets, it's not kinda crazy. And then we'll simplify that model of the graph of English, simplify that down to just high medium low. So just think about it in those terms. So we have kind of this pattern, so you can think about with English, you have this pattern of high mediums, high mediums, high so the highs are all the sites and then you have a series of loads at the end. So how does this help us or does it? Yeah, we can see shifting this alphabet in these different ways, how does that affect and change this value? Right, so we can essentially try decrypting, right? So we can even look at this first alphabet, right? So the very first alphabet ignoring everything else. How does that match up? Or what shift would you do? So let's think about maybe you're thinking, okay, let's look, E is the most frequent, maybe that's actually A. So let's shift everything back by one, two, three, four. Shift everything back for, oops. Right, and then what does that mean for this high? One, two, three, four. So now we've just put W as a very frequent character in this cypher text, so that probably doesn't make too much sense. Yeah. It's actually really close, just not doing anything. It's actually really close, not doing anything. Is that good, bad? It could mean the letter was A. Yeah, so it could mean the letter was A, which kind of seems, on the surface, silly, you can be talking about a Caesar cypher, but would you ever pick zero as your key? Right, because if you pick zero, it's not going to correct your message. But the visionary cypher, could you have one of, would you want the key of all A's? But could you have A's in your key? Yeah, because they're hidden by everything else. It's just not shifted at all. Right, so we could guess for the first alphabet, no shift. It actually matches very well. It has a peaks at A's and E, a peak at O. What about the second alphabet? So the other thing that's kind of nice, like let's maybe look at the third alphabet. The other thing I like to do is to look for like a series of lows because there's this nice part of the alphabet where kind of the ends are all, there's a one, two, three, four, five in a row of zeros. So if we were maybe to think about this as the end of the alphabet, what would that make this first character, I? A, which is kind of high. I mean two, we'd have A, B, now you need like two fingers, which I can't show you here. A, B, C, D, will that make this? E, which is a high character frequency. E, F, G, H, I, which is a high character frequency, is that right? Yeah, I is high character frequency. So maybe the third alphabet, maybe shifts A to I, whatever that shift is. So it would be an I as the shift. Ever agree that maybe that would make sense? Just exactly so. Like I mentioned before, this is a puzzle essentially that you're trying to uncover. So when you're doing this, it would take a while to try different things, try those shifts, see how that matches up. So I know these answers, so I'm gonna lead us to them, so we're not spending all day just working on just one problem. But it's natural when you're doing this on your own for it to take a little while. So don't freak out when, but it's important that if you get two stuff, maybe you come to us for help or you can double check your assumptions, maybe you got the key length wrong. And now you're trying to decrypt things that don't make sense. Okay, and we can look the sixth alphabet. So just kind of roughly looking at it and looking at the sixth alphabet. Yeah, okay, so V, yeah, so here's another grouping of zeros. So shifting all of those to Z would map V to A, and you can see that other one's kind of map up too. So we can maybe start with these three assumptions. So we can say, okay, what if we assume the first alphabet is A, so unshifted, the third alphabet maps A to I and the sixth alphabet moves shifts A all the way to V. So now what do we do? Try it. So we can try it with the cipher text, right? So we can try shifting each of these three alphabets, which we know how to do with the Caesar cipher. And I'm gonna put in, yeah, okay. So I'm gonna put in bold the things that we think we know. So these are the three alphabets will be in bold with the other ones. And now what do we do? So one thing to be trying before thing, we can also just try seeing if we see any patterns with the bold characters. I think in the next slide it'll be. I think it said A, J, E, and that was right above your mouth. Oh, yeah, I know. I'm just trying to see if there's anything else that anybody sees. So the interesting thing is that we have at least the characters that are next to each other. We can try to see in any direction if we see maybe something that looks like the. Is that a bolded A, G, and the second row from the bottom of our left side? It is. Yeah. Yeah, okay, that'd be one thing to try. That's great. Keep that in mind. I don't know if that's right or not, so we'll see. But that would be definitely something to try. What else? Yeah. There's also a T-W-E and going from the second line to the third that could be of a. Yes, there we go. So there's a T-W-E, so that could be the T-H-E. Yeah, that's good. I'm really bad at word games, though, by the way, so this is something I'm very bad at, which is why I have all of you. And so, okay, anybody else have any ideas? Yeah. A, J, E, let me see. Oh, okay, yes, yes. Here, maybe bold is not the perfect choice, but the M is not bold. It shouldn't be bold, right? Oh no, it is bold. It is bold. Okay, yes, yes, yes. J is not, okay. So yeah, you could try maybe, I don't know, Mace or, I don't know, you could try whatever words are four-letter words that M, A, blank, E. A tricky thing, though, is not having spaces, so that also messes you up a little bit. There could be a space kind of anywhere within there, so we need to take that into consideration. We could, and I don't know if I'd necessarily get here, but one way you could think about this is A, J, E. You could treat just that as its own word, and think of a popular three-letter word like that. So you could say R, and maybe try that. So try mapping A to S for that alphabet. So you could say, okay, this looks maybe more, does it look English-y? We got where? Rick, Pace. Yeah, so at least we're double checking now that at least that, does that guess make sense, right? So we can see, does that just make it all gibberish or did it actually, none? Yeah, that's good. What was that? How did our the go? Did any of our thes pop up? T, R, oh, that's a good one, that's a good sign. None. Oh, R, there we go, nice. These spaces are really annoying. Goo, I don't know if that's a word. Goop. But, it's a common word. All right, anybody, what would you, so let's say we started from here, what would be next guesses, maybe? One, two. Sorry, I don't get the numbering scheme. I thought I, oh, fifth, yeah.  The clown are taking over. Oh, that's creepy, okay. The clown on, it goes. Yeah, so we can try, okay, T-H-E, that would be one thing to try, that's a good one. Anybody have any other guesses, yeah. Oh, good, yeah, so that would be a good guess. The last block only has one letter missing. So what would you guess though? Me can? Yeah, so actually, so one thing you could do is look up dictionary words and you could see it, because we could actually, yeah, this is a nice way to kind of prove force it, because we can say, okay, A something, I mean, I guess you could have a tire phrase end with act or an or something, but that would be not great. You could say C-A-N, maybe can or something, or you could, maybe if it's all one word, you could look at like M-I-C-A, what's like a common ending for that? What was that? Micah, if it was a word, if maybe we knew something about this. Yeah, anybody have any other? So it's not certain letters, it's alphabets. So what I'm doing is, so for instance, here mapping the second alphabet from A to S means I'm taking this alphabet, Duke, whatever, this alphabet. So starting with the second one, every character you're shifting from A to S, or sorry, from S back to A.  And you could write a program to do this too. So it's actually kind of nice to be able to, I don't know, try different shifts and print it out together to see what it looks like. Oh, shoot, yes. Which one? Oh, here, A and P. And, okay, is that P the same? And then that would also be a good. Yeah, that's actually a great point, yeah. Yeah, yeah, I like this goop. Maybe a better approach would be to color the remaining alphabets so we could see which ones are in the same alphabets so we could see that that good, like that same P in two different places we think would be very nice to be Ds. So that would actually give us an excellent shift to try. Okay, if you're, I guess, really big on English, you could do something like this and figure out that the last line suggests a mechal, a common ending for an adjective. So that would shift the fourth ab. And so at this point, we could brute force the last alphabet. We could, what happened to our Ds? Did our Ds appear? It did? Where is it? Why can't I see it? Oh, and yeah, the roast. Okay, that's why I was going crazy. Okay. So good showed up and our and, our good buddy and showed up. How is that? Why did I do that? It's insane, all right. Yeah, so we could do anything. We could brute force it right at this point. That would be easy. Or we could do exactly all the cues that you're thinking about. And we could do this and then we got it. We could also use, let's see, QI here so you could say that if we know it's a Q, we highly likely a U follows it. So we could try that. All kinds of tricks that you could try here. So we finally get our plain text. I'm not gonna read it. You can read it on your own time. It's a silly limerick, but you can't even read it. Left to right, top to bottom. Okay, I'll just go let you do this. There we go. I should have had you do that on the mic for everyone.   Yeah, it's tricky. Yeah, so there we go. We just broke this cipher as a group and you guys had much better intuition and kind of paths to go with this, right? So you can see how this is kind of a choose your own adventure or puzzle and you can try different ways of going at the back track and figure out different things. So it's really important when you're trying to solve one of these ciphers to look at it and make sure you understand and you're very clear about what assumptions you've made to get to where you are now, right? If you keep getting stuck and stuck and everything seems gibberish, maybe you made a mistake with either the period or one of the other steps or maybe you're coded wrong to do the decryption. This is what I've seen before. So you should, one of the best ways to practice this is if you have some visionary cipher algorithm take your own plain text that you know exactly what it is. Encrypt it with a key that you know exactly what it is and try to decrypt it by hand or with your tools. If you can't do it that way, then you're totally, something is very wrong and you'll never be able to break it if you can't break something that you know what it is. Cool, questions on this? All right, cool. So the other type of cipher that we've talked about before, so we talked about substitution ciphers which is what we've been looking at, substituting one letter for the other. We can also do transposition ciphers which basically essentially change the letters in the plain text, in the plain text to produce cipher text. So you're doing no substitutions which means you have this very nice property where you have the same one gram frequencies, right? The letter distributions are exactly the same because it is the English text that you have. It's just moved around. The letters are moved around. What is going to be different though? Say it again? The position of the letters, yes. Yes, exactly, with respect to the other letter. So one gram frequency is one character, two gram frequencies is the frequency of one character following another. The three gram frequencies are the three in the sequence. So all of those get mixed up and broken when you shift characters around. And you can look and analyze, just like we analyze the one gram frequencies for English, you can analyze different n gram frequencies. And the interesting thing is that the index of coincidence is going to be exactly the same as English because we haven't done any substitutions. So we can think of, there's a number of different substitution ciphers, or sorry, transposition ciphers. So the idea is we could break a, so a simple one would be break the message into blocks. So blocks of letters. And the key is how you transpose and move around those blocks. So you could have a key of three, zero, two, one. So this means our block size is four, so we have to break the characters into blocks of four. And then the way this key works is the zero with character will go to the third index. The first character, I'm using zero indexing, I hope that's okay. The first character is going to the zero index. The third character is going to the two and the fourth character is going to one. So doing that swap and doing that swap on every single block. So you'll then get something like this. So again, we haven't completely, we've just mixed up the order here. We haven't gotten anything. So we see we moved a to the last one, to spot three. We moved s to zero to the front. We moved you to two in the same spot. So the you never moves. The third one doesn't move here. And the one goes back here. Pretty simple. It's called simple transposition cipher. So how would you attack this? Yeah, so you can use basically the similar ideas and similar approaches when we've talked about work here, right? We can look at each block and we can maybe say what makes sense. Can we maybe make words or something by swapping some blocks around? But what's the key size? So we tried to brute force. So how many possibilities are there here? Yeah, the key size. Correct, yeah. So let's ignore this problem for now. But yes, there is a problem inherent here that if there's extra, let's say our message is always gonna be the correct offset of our blocks of our key size. So what about a brute force? So how many four digit keys are there here? Yeah, yes, why? What's the operation? Yeah, so it's a factorial operation. So the size of four, it's four factorial, which is four times three times two times one. And then with five, it's five factorial. Six, six factorial. So you can think of, I don't know, that increases very quickly. So you can have, with a key size of 13, you have, well, it was a six billion different keys to try. So maybe brute forcing is a little bit more difficult. But we have our friendly, friendly, nice technique that we've been looking at of doing English analysis. And specifically, we likely buy grams and try grams. So specifically looking at letters that are likely to follow other letters. And again, we've used exactly the same techniques we've used before. We'd look at each different block. We'd maybe analyze it to say, okay, what's the highest likelihood of one character following another? If there's queues at Q and U in one block, we'd swap those so that they were next to each other and then start working and going from there. We'll see more of this in the next cipher. Okay. So I don't know why that was messed up. I'm gonna fix that real quick. Okay. So the rail fence, but the problem here, the problem before is that we have these kind of, these notions of blocks, right? So we're only mixing letters and swapping letters that are in one block. So a rail fence cipher is kind of a different, clever way of how to do this. But essentially the idea is you rearrange the plaintext into a different format and then read it off differently. So for instance, we have the plaintext hello world. We're gonna write from top to bottom. So we're gonna do H-E-L-L-O-W-O-R-L-D. Like as if like a, like the fence, like we're putting it on the top of a fence, I guess. And so we write H-E-L-L-O-W-O-R-L-D. So we write it top to bottom left to right and we read it normally. So left to right, top to bottom. So the cipher text then is H-L-O-L-E-L-W-R-L-D. So what's a benefit of this versus the previous approach? The size is as large as the plaintext, right? It's the, our characters can move and our key here would be how many rows and columns do we do? Or how many, I guess, rows do we do? Here we're doing two. We could think of using three and the same technique. We could do, we could read it off in different orders and write it out in different orders. But yeah, fundamentally here we're now mixing and transposing more characters across more of the keys. So an attacker can't just reason about it in terms of blocks. They'd have to reason about it in a bigger way. Yeah. Ooh, interesting. I don't know. Yeah, that's an interesting thought. I don't know how that would impact. Maybe if it was in your language, like that language would be particularly bad to do it this way. But I don't know if right to left, top to bottom writing would impact this. That's interesting. I bet you could do it in the opposite way. That would be unexpected. Cool. So these are kind of simple things and this is something you could just do on paper, right? This isn't a complex algorithm. It's gonna definitely do that. Cool. So how do we decide, so more to high level, so we're given some ciphertext. Maybe we don't even know what algorithm is used. How could we try to determine that? Okay. So for the previous example, yeah, so we could H-L-O. So A, we can know that it's encrypted somehow because it doesn't make sense, right? Yeah, so we can check the one gram frequency. So we can look at the distribution of letters in English. If it matches 100% with English or matches very close to the English, but we can't read the message, that means it's probably a transition cipher. If not, then that would tell us that it's a Caesar cipher, or sorry, that it's a substitution cipher. So then, okay, if we know then it's a substitution cipher, then how do we go farther to determine Caesar versus Vigenere, yeah? Yeah, so we can, exactly. So we can actually just easily test Caesar cipher or even just brute force a Caesar cipher and see if that works. If it doesn't, you know it's not a Caesar cipher. We could use the index of coincidence. We can use correlation. We can use our statistical analysis. We can look at the frequencies. We can try to, anyways, so these are all different ways that we can use to try to determine what it is. In real world crypto, they actually use oftentimes XORs instead of shifts. So why is that? Somebody remind me what is an XOR? Exclusive OR, so what does that mean? Yeah, yeah, so XOR zero is, or is that the only difference? Yes, so XOR zero is zero and one XOR zero is one, zero XORs one is one and one XOR one is zero, right? So why do you think they use this so in, so okay, we talked about what it is. Why do they do real systems? They use this more than a shift. Yeah, it's true. It's very fast for computers to do this and it's very, you don't have to worry about numbers being zero to 25 and transferring the ASCII value to the number whatever you could just do in XOR. You XOR something into a value and you XOR that same value back and you get the original result. So okay, yeah, and I'll show you an example. We'll do this really quickly. Don't implement your own crypto algorithms. This is what I've been trying to say for a long time. There are plenty of ways to get this wrong. There are side channel attacks. So there's all actually crazy research that they've shown that so they showed that if somebody can get access to the power readings of your system while it's doing some encryption operation, they could break the key that way because different operations on a CPU use different amounts of power and you could figure out what those operations are by the power usage just outside the server and they went even crazier and used the sound that the fan makes because the fan noise is correlated with the power draw which is correlated to what CPU operations are used so they can actually break just by listening to the fan noise they can break your cryptographic keys just by using that. There's all kinds of techniques now where if somebody's executing on your machine they can use a shared cache between your processes to try to determine what your keys are. There's also crazy things like timing attacks. So this is a very classic one. It's why it's incredibly difficult to write crypto operations because the amount of time it takes for a correct operation versus an incorrect must be identical although if that leaks information to an adversary so you can break crypto systems if they fail early sometimes or if some operations take less time than others. So I wanna tell you one example before we go of a, this was a DEF CON QUALS 2011 challenge that I worked on. It was called the binary leatness and the score was 300. So it was a tar archive. So it was just a zip file basically with a .dex file. So let me know what a .dex file is or was. It may do Android development. So it's basically an Android app and JPEG S. So the S ostensibly stood for secure. When we looked at this and this is insane that this app still exists. So they used a real app that's on the Google Play Store. It's a free version and it says that it encrypts your photos with a, it does encryption on your photos. What it does is it uses an eight byte key. So eight bytes and it does XOR. It's essentially a vision air cipher that did eight bytes over repeating over your picture to save out this secure version. And your goal was to find out the key and so we broke this because you can do a certain thing like you know certain fields in a JPEG are always the same. They're magic bytes based on the structure of a JPEG. So you can use that to break and figure out I think at least three or four of the eight bytes. And then the rest you could actually just brute force until you generated a valid JPEG file. And then when we finally broke this it like the picture was a picture of a whiteboard with the flag written on it. And this still exists. Is this app that you could go pay for and think that you're getting securely storing your keys or your pictures when it does not. And so it's really sad. So the free version does not do any real encryption. It says it does. But you can pay money to get one that actually uses allegedly real cryptographic operations. So people still use this stuff. Don't do it.  When we get back we're gonna talk about modern encryption systems. Hey, the recording.


We are going to move on now to the next item of business, which is a statement by Shirley-Anne Somerville on delivery of devolved benefits. The cabinet secretary will take questions at the end of her statement. I would encourage all members who wish to ask a question to press their request to speak buttons as soon as possible. I call on the cabinet secretary, Shirley-Anne Somerville. Last year was a momentous one for Scottish social security, and we started to build a new public service for Scotland. The Social Security Scotland Act passed into law last June. Three months later, our country's new agency, Social Security Scotland, opened its doors. Since then, we have put over £35 million of additional funding into the pockets of people in Scotland, delivering the first two payments of the carers allowance supplement and the best start grant pregnancy and baby payment. This year, we will introduce four new benefits to help young carers and low-income families, and we are also consulting on our new job grant for young people moving into employment. We have made a strong start, and today I will set out our plans beyond 2019. We have already taken responsibility for carers benefits, our carers allowance and carers allowance supplement. Together, we are an investment of £320 million in 2019-20 alone. On 1 April next year, we will take full responsibility for the remaining devolved benefits, which means that benefits will start to be fully funded by the Scottish Government. From that point, Social Security Scotland will progressively take over administrating those benefits from the Department of Work and Pensions. For the first time, the Scottish Government will make regular social security payments, week-in, week-out, direct to people's bank accounts, payments that Scottish families will budget into their weekly shop or monthly heating bill. The complicated nature and interdependencies of both social security and devolution means that this is no mean feat. Two Governments, two agencies will share clients. The payments that people get from the DWP in Social Security Scotland will affect and, in some cases, need to interact with one another. This is not a lift-and-shift approach where we take over the whole of social security and start changes from the inside out, whilst that would have, of course, been my preference, and it would arguably have been a simpler process. However, what we are starting from scratch is effectively needing to untie one set of benefits from a labyrinth-like DWP system, build our own system to allow for the transfer and then make sure that the systems work together seamlessly. It is imperative that we get this right so that people not only get the right money at the right time but are still eligible for other assistance that they can be passported to as well. This is a formidable responsibility that I do not underestimate and it is also a great opportunity to forge a social security system infused with dignity, fairness and respect. What is clear to me, what we have heard repeatedly from people with direct personal experience of the current system, is that we must ensure that people entitled to these benefits are protected during the transition. Yes, protected from aspects of the current DWP regime, but protected too from the errors that inevitably follow when politicians rush through big changes in social security. We do not huff to look far. The debacle of the DWP's migration of people from incapacity benefit to USA, the DLA to pit migration due to finish in 2015, then 2019, now delayed until 2021, and above all the universal credit programme, due for completion by 2017, now it is 2023, six years later than planned and yet still fundamentally flawed. We all need to learn lessons of these failures and it is clear to me that changes to social security need to be implemented with painstaking care, always at paste but never rushed or we run the risk that people fall through the gaps. Take the time to get this right is the message that I am hearing. Last month we conducted anexperience panel survey about people's priority as our agency takes over cases from the DWP. Of over 400 respondents, 57 per cent said that they wanted the Scottish Government to strike a balance between transferring cases quickly and making sure that there are no mistakes. A further 29 per cent would rather we took still more time to avoid errors. Since my appointment, I have been listening. I am well aware how high the stakes are and I will not take risks that endanger people's payments. We have seen that it is those who rely on the payments the most who then pay the price. Over the past eight months, I have been talking to people with lived experience and challenging my officials on what can be achieved, balancing pace and risk, with clear principles in mind. Protecting people and their entitlement, acting quickly to reform aspects of the current system that cause most stress and ensuring that we put into place a dignified and respectful system that works for Scotland. After careful consideration, I have determined on a timetable that taking over the remaining benefits, which, based on current plans, I believe was challenging, is realistic. As I have said from April 2020, we will become responsible for the remaining devolved benefits and I am delighted to say starting next summer that the first disability benefit to open to new claims will be disability assistance for children and young people. We will also deliver on our manifesto commitment to extend eligibility for this benefit from age 16 to 18. That will allow continuity for families during those crucial transition years when a child becomes an adult. Also from next year, children who receive the highest care component of disability assistance will be entitled to winter heating assistance too, meaning 16,000 children in their families will get a £200 lump sum to help towards their heating costs. Coming up the pace early in 2021, I am pleased to say that we will introduce an additional payment for the estimated 1,800 Scottish carers who look after more than one disabled child, recognising the higher costs they face. By the end of 2021, we will also start paying winter heating assistance in its current form to eligible older people in Scotland who receive another type of payment from our agency. We will also make the first cold spell heating assistance payments too. Coming to new claims for disability assistance for older people, those over state pension age who need someone to help them because of a disability. I can announce that that will be introduced by the end of next year. Building on that progress in early 2021, we will introduce the largest, the most complex form of disability assistance, the new claim service for working age people replacing DWP's PIP. I remain committed to co-designing those benefits with the people of Scotland. A person-centred approach will be at the heart of Scotland's three forms of disability assistance. Through major reforms of the assessment process, we will significantly reduce face-to-face assessments. Where assessments are needed, we will deliver them through our own agency, not through the private sector, and people will be invited to attend assessments at a time and place that suits them, with the assessor coming to them if required. By the end of 2021, we will also deliver new claims for Scottish carers allowance, folding together that benefit, carers allowance supplement and additional money for carers of more than one disabled child in a way that meets carers needs. Presiding Officer, I have carefully considered whether Scottish carers allowance could be delivered more quickly, and I know that carers are rightly keen for us to take it over as soon as possible. I have concluded that carers allowance above all is a benefit to which we have to take the time to get right. It interacts in a particularly intricate way with functions that remain reserved. It affects income tax, for example, meaning that we will need new data sharing arrangements with HMRC to administer it effectively. It is also a gateway to other benefits that are in the gift of the UK Government, such as the carer premium, worth around £36 a week on top of someone's means-tested benefit. The last thing that I want to do is to jeopardise those additional payments by rushing delivery of carers allowance before the necessary agreements with the UK Government are in place. Nor do I want to encourage the growth of a two-tier system between new and existing claims. By introducing new claims in 2021, we can ensure that we protect payments for carers who rely on them. It will also allow us to focus on getting all three forms of disability assistance right to support the people who are cared for by our carers. That is particularly important, given the scale of change that we are proposing to the application process, the despase decision making and face-to-face assessments. I am therefore pleased to say that, by the end of 2021, we will be delivering new claims for all disability and carers assistance and supporting families with their winter fuel bills. I now turn to the task of moving people's existing claims from the DWP to Social Security Scotland. I mentioned before the importance of ensuring that we protect people's benefits as they transfer. That is as true for existing benefits as it is for new claims. We must move people to our agency in a way that causes them minimal anxiety while safeguarding the payments that they are currently getting. Feedback from our experience panels shows how we can achieve both. I mentioned earlier a survey that we conducted last month with people experienced in the current system to ask what is most important to them as we take on their cases. There are top two priorities where people should continue to receive the correct payments at the right time and that no one should be subject to a DWP face-to-face reassessment for disability benefits. We will use that research as the basis for a set of client-centred transfer principles agreed with user and stakeholder input. Let me be clear today that we will protect people's payments during transfer. From early 2021, when we launched new claims for our PIP replacement, I can guarantee that no one in Scotland will undergo a DWP face-to-face assessment for disability benefits. Before someone reaches the end of their DWP award period, we will take over their case so that this cannot happen. I can also guarantee that, unlike for universal credit, we will not require people to make a new claim to move on to the Scottish benefits. Instead, we will work with the DWP to arrange the transfer to happen automatically. We will keep people informed of what will happen and when, before and during the process. We will start the work of transferring people from the DWP to our agency next year. That involves moving more than half a million cases—10 per cent of people in Scotland. Such transfers have, in the past, caused huge problems when the DWP has migrated within its own benefits system, which has not been done before as transferring people from one Government's agency to another. We must do that effectively and securely and in conjunction with the DWP. With its co-operation, I expect the majority of people to be transferred by 2023, with all cases fully transferred by 2024. What I had not anticipated during that work was the further delay to the DWP's daily to PIP migration, which means that people of working age will still be on two benefits at the point when we expect to transfer them to a single form of Scottish assistance. My officials are in close contact with DWP officials on this matter, and I have also requested a meeting with DWP ministers to discuss the implications. I will, of course, report back to Parliament once discussions are more advanced. Going forward, we will work with the DWP to develop agency agreements to partially administer the devolving benefits until Social Security Scotland is delivering them in full. Those will ensure that people receive the regular payments that have already been awarded with minimal disruption and distress. That is an administrative function, but it does not affect when we commence powers or start funding benefits. As I have said from April 2020, benefits will be fully funded by the Scottish Government. Delivering the devolved benefits is very much a joint enterprise with the DWP, and we rely on them to match our ambition and pace. The timescales that I have set out remain very challenging, and there are many unknowns, both within our work on social security devolution and beyond. We will therefore keep our plans under careful review and I will keep Parliament updated on our progress. We should not forget that we are at the first Government to begin the partial separation of a highly integrated welfare system between two countries. That cannot be done without taking difficult decisions on timing, but every day as we break new ground, we gain more experience of how to accomplish the most complicated feat of devolution attempted since this Parliament was reconvened. A great deal of activity is already well under way to make our current plans a reality. Today, I will publish 11 policy papers setting out the extensive work that has gone into designing how those benefits will operate. Next week, I will also publish a consultation on disability assistance to seek the views of the public on our proposed reforms, including introducing rolling rewards with up to 10 years between reviews for people whose conditions are unlikely to change and how we will ensure that people who undertake our assessments for disability assistance are suitably qualified. In parallel, we will pursue our ambitious timetable for 2019. By the end of this year, just 18 months from Scotland's Social Security Act will have delivered three of the 11 devolved benefits and four brand new payments. Two years hen Social Security Scotland will have made more than £210 million in benefit payments, agency staff will have supported 200,000 people and we will have brought a new culture of dignity, fairness and respect to Scottish social security. Certainly, we have our work cut out as we deliver devolved benefits to the people of Scotland, but the prize is great. I thank the cabinet secretary for advance and site of her statement. I absolutely agree that the transition must be handled properly. It is about making sure that the people get the support that they need. They are the priority in all of this. However, the cabinet secretary must see the utter hypocrisy that this statement exposes. For two years, you have slammed the DWP. You have used highly charged language on the UK Government's administration of benefits. You have raised expectations and promised the earth to some of Scotland's most vulnerable people. After repeated promises that the new system would be up and running by the end of this Parliament, we now learn that it will be 2024 before PIP's successor is in place. This is from the party that said that it could set up an independent country in 18 months. It will have taken nine years to introduce the devolution of 11 social security benefits. Can the minister not see that this is deeply embarrassing? Next April, she takes over executive competence. My question to you is, will you now apologise to the hardworking Scottish DWP staff? She has repeatedly denigrated and whom she is now asking to keep running benefits for another five years on her behalf. Let's be absolutely clear. I will make no apologies for criticising the DWP for the way that they tackle universal credit and other aspects of this. It is never the staff who are responsible for the policies of their political masters, and it is the staff who have to bear the brunt, unfortunately, on the front line of the policies of the Tory Government. The successor to PIP will be in place in 2021. It is very important to recognise that this is the area where most people have a criticism of the DWP system as it is at present, and that is why we are making substantial changes to the assessment process, to the application process and to the desk-based process. If you can think that that is not a good thing to do, if you think that we should just lift the DWP system and transfer it over, then what a missed opportunity for the Scottish system in here? It is absolutely not the case that this can be compared to what can come up with independence, because, as I said during my statement, this is a partial attempt to prize out 15 per cent of benefits from the system rather than a lift and shift of it. The fact that this is actually around partial devolution is indeed part of the intricacies of this programme, and I am sure that Michelle Ballantyne would have been more aware of some of the difficulty of that, had she been able to attend the programme development opportunity that she had within Victoria Key to talk through exactly some of the challenges that we have when we are developing the system and she could come to it with that process. It is very disappointing that, rather than seeing the opportunities that we have as we deliver a substantially improved service within Social Security Scotland, Michelle Ballantyne still thinks that the DWP is doing a good job under the Conservative Government, and that is exactly why we will have a very different policy up here and a very different experience for everyone that is experiencing social security within our agency. I encourage everyone to keep their remarks respectful and through the chair, and do not use the term you. Mark Griffin. Presiding Officer, I am disappointed, disgusted even at some of the details that have been brought to the chamber. Labour has long called for details of the timeline for delivery of social security systems, built on dignity and respect, and now we know why we have been told so little. Yet again, the sick, disabled, older people and carers will have to wait to see a fairer social security system. This morning, the cabinet secretary said that it was a choice, a choice to use CPI, a choice to use agency agreements to see carers being forced to cut their working hours. Today, the cabinet secretary wants to force those same choices on Scotland's disabled communities. No doubt paying millions to the DWP for the privilege. It also makes a mockery of the SNP's promises in 2014 that a separate Scottish state could be set up in 18 months, when vulnerable people will have been waiting a decade for the full devolution of social security powers. I am not asking the cabinet secretary to apologise to DWP staff. I want the cabinet secretary today to apologise to every single disabled person who is leaving at the hands of the Tories for another five years. As I set out in my statement, we have published today 11 policy position papers that will absolutely determine the work that is going on to get to the decisions that I have taken today. To Mark Griffin, who also did not tend the information session with Social Security director at staff either, had he been through that, he would have seen some of the decision-making alternatives that we have been looking at. As a genuine offer to the Labour Party as we go through this process, if you have alternatives—if you absolutely have alternatives—then I am all ears. Today I will be sending out an invitation to all the spokespeople from all the political parties to go through in further detail that we can never do so in the chamber today to discuss this in much more detail. If you have alternatives, then bring them forward, but make it realistic. Do not pretend to people that you have an alternative, because at this point the Labour Party has never demonstrated that they can deliver a safe and secure transition and deliver what people want, which is to ensure that they get their right payments at the right time. That is what the timetable is doing that I have announced today. If the Labour Party has a credible, realistic alternative, then I am all ears to be able to look through it, but I fear that, just like the budget, it will be all-talk and no delivery, because that is exactly like the Labour Party act in opposition. Quite lengthy opening exchanges. Can we keep the rest of the questions and answers quite succinct? Ruth Maguire to be followed by Alison Johnstone. Given the UN special rapporteur on poverty and human rights, describe the UK Government's approach to welfare as punitive, mean-spirited and often callous? Does the cabinet secretary think that it is important to reassure people by reiterating our ambition to do things differently here in Scotland and build a social security system based on dignity and respect that works for people and not against them? Believe it is imperative that people are able to put trust back in a system as we build our new social security system, and it works for people rather than against them. We will do that by ensuring that we get decisions right the first time. Our redesigned application process will be accessible and clear, and because we recognise that it can be difficult for clients to gather relevant evidence, social security Scotland will help with that. We will use the supporting evidence to make more award decisions without the need for face-to-face assessments. Where they are required, we have outlined our commitments, as I set out in my statement, that it will be undertaken by assessors that are suitably qualified and at a time and location that suits clients. All awards will be rolling with no set endpoints and reviews will be set at dates that take account of clients' conditions, and we will ensure that people with fluctuating health conditions do not face additional reassessments because of regular changes that they experience as a result of their condition. In her response to Ruth Maguire, the cabinet secretary has highlighted the fact that no face-to-face assessments for disability assistance will be carried out for children, young people and older people, and for other applicants all efforts will be made to use existing evidence. That comes from a green amendment to the social security bill supported by all parties in this chamber that I am really proud of, but can I ask the extent of the cabinet secretary's ambition in this regard? Is she aiming, for example, that the great majority of working-age applicants will not have to go through a face-to-face assessment? That is our determination to get the level of face-to-face assessments down to the minimum possible level. The chamber will see when the disability consultation is launched next week that we have asked the expert advisory group for a great deal of advice on this particular issue to see how we can get the application stage right, how we can get the death-based decisions correct so that the face-to-face assessments are not required. I went back and asked for more advice and guidance on the issue, because I want to make sure that we do everything at the initial stages that we can possibly do to ensure that the face-to-face assessments are not required. We see that as only being required if there has been no other way for the agency to gather the evidence that it requires. Of course, it is the responsibility of the agency to gather that evidence and not on the individual. As I said in my response to Mark Griffin, the letters will go out to all the spokespeople from all the political parties, and I am absolutely determined to ensure that we can do whatever we can to minimise face-to-face assessments and more than happy to consider that in much further detail with Alison Johnstone once she sees the full consultation next week. Alex Cole-Hamilton has often shared common ground in our opposition to what was called the DLA takeaway, in which DLA payments to children and their families were removed after protracted hospital stays of 87 days or more. Given that the cabinet secretary has announced that the new system of benefits to children with disabilities will open for claimants in 2020, can she confirm that there will be no such impediment to Scottish children who have to go into Scotland into hospital for protracted periods of time? That is one of the areas in which the consultation will be launched next week and will look at and determine. What we need to ensure is that when we are looking at all the three disability payments that are coming forward, we look very carefully at the priorities that people are looking for us to change. That might mean that we cannot do everything that everybody wants at the first time of asking because that might have implications for how long it will take to deliver and build the system. However, what I am looking for during this process is a genuine and open frank discussion about what are people's priorities and what are the implications for the programme if any, if we implement those priorities as well. I know that this is an area in which Alex Cole-Hamilton has a keen interest. Those are the type of discussions that we can get into over the consultation process about what are people's priorities and what are the implications if we are looking at that for our programme as we move ahead. Clare Adamson, to be followed by Jeremy Balfour. Cabinet Secretary, in yesterday's debate, there was much discussion on the welcome increase in financial support to carers. Can the cabinet secretary outline how the decisions taken so far support carers and show what can be achieved when a dignity and respect approach is taken to social security? Cabinet secretary? We have prioritised support for carers in our new social security system. Indeed, our first change following the social security act coming into force was, of course, to increase the financial support to carers through carers allowing supplement we have improved the incomes of over 77,000 Scottish carers by £442, bringing it into line with jobseekers allowance. That is an increase of 13 per cent and an investment in carers of over £33 million this financial year. As we have committed to, we will increase the supplement annually in line with inflation and in 2019 carers will receive an extra £452.40 compared with counterparts in the rest of the UK. With our full funding of carers allowance and the supplement in 2019-20, investment in carers is at £320 million. We will also introduce an additional payment for carers who will look after more than one disabled child, which will benefit around 1,800 Scottish carers from early 2021. I have to say the message that we got on Tuesday. The London time was very different than we hear it today. I am sure that she will be speaking to her colleagues Alice Dahl and Keith Brown, and so is the sort of option for not being at that such vital important meeting. Can I take the cabinet secretary on to a really important issue and just remind the chamber that I am in receipt of PIP? For those of us who have already received PIP, when we transfer across in 2021 or some other time after that, will it be done under the present DWP regulations, or will it be done under the new Scottish regulations? If it is done under the new Scottish regulations, will that not require a fresh-filling out of forms to assess whether the benefit is of the right value or not? The area around the transfer, particularly of people who have moved from DLA to PIP, is something that I am sure that Gelly Barlford would recognise. I have given a lot of consideration to it because it has had some very difficult and distressing experiences in the past. What we have ensured and committed to again today is that if we transfer, when we transfer over to the Scottish agency, we will not have to reapply and we will not have to be reassessed. That is a very important assurance that we are not putting additional barriers in front of people as we move forward to the transfer of their cases. If an individual requests a reassessment because their change is a fluctuating condition or their condition has deteriorated, that would be looked at very differently. However, if it is a simple case of someone who is having to require to transfer over to the agency, there will be no requirement to fill in new forms and no requirement to be reassessed during that process. I hope that that will provide some reassurance to Jeremy Barlford on that issue. I will jangle, Ruth, to be followed by Pauline McNeill. I see the horrendous problems that are caused by universal credit and the transfer to PIP in my casework every day. Is there anything that the Scottish Government can do to support people in receipt of benefits from any further upheaval? I have outlined in part to Jeremy Barlford there that we will do things very differently from recent DWP migration. Our case transfers will be based on the needs of people with lived experience of the current system. We have sought their initial thoughts on that. Once we have launched our consultation, members will be able to see that we will develop a transfer principles that underpin our transfer requirements. However, as I have guaranteed today, when people's cases transfer, their payments will be protected and they will get the right money at the right time. That is very important reassurance for people to have, as well as the fact that they will not be subject to a face-to-face assessment. The other aspect about not forcing people to reapply is very important, as we are learning the lessons of what has been proposed within universal credit, which many stakeholders say will cause people to fall through the gaps during that migration process. Our transfer process will be very different to that. Pauline McNeill will be followed by Stuart McMillan. This morning, cabinet secretary said that it was a choice that carers could be at risk of going over the carers allowance cliff edge if they earn more than the threshold. However, this afternoon, the cabinet secretary is telling the chamber that she will maintain that choice for years to come. Can the cabinet secretary tell me what to say to Scotland's 80,000 unpaid carers as to what they should say to their bosses when they have to ask for fewer hours or completely lose their entitlement to this supplement? How will she make up for the lost income because of the choice to extend the full transfer of powers for social security by three years to 2023? Well, what happened this morning was that the Labour Party voted against an increase to carers allowance. That is absolutely what happened in the committee this morning, and that is a deep disappointment that they did so. We did discuss in committee the fact that there is an agency agreement to allow the Scottish Government to very quickly deliver the carers allowance supplement. I said this morning to committee members, and I will say again that if we did not do that agency agreement, we would not have been delivering the carers allowance supplement. Just as the Scottish Government has made choices, I think that to be a responsible opposition, the Opposition parties need to look at, if they did not want the agency agreement, to be frank to people that they would not have had their carers allowance supplement, because that is the reality of what you are saying. If you are looking to change agency agreements, you should be frank to people about the implications of doing that. That is why I have made it very clear in my response to Mark Griffin that if you have realistic proposals that want to come forward, my door is always open, but I doubt that that will happen. Stuart McMillan, to be followed by Graham Simpson. How can the Cabinet Secretary guarantee that the Scottish Social Security System will treat people with disabilities differently and challenge the stigma around benefits associated with the UK Government's system? I think that it is absolutely important that we challenge the stigma around benefits that people unfortunately face at the moment. That came out very loud and clear as we developed the charter and it was within that charter. That is why I am determined to ensure that disabled people in Scotland get access to the benefits that they are entitled to in a way that supports their needs and treats them with the dignity and respect they deserve. We will ensure that we have a person-centred service with dignity and respect embedded in that framework of disability assessments. I am supposed to concentrate on a concrete example on that, as well as what I have already outlined in relation to assessments. I have very serious concerns, for example, about the 50-metre rule in relation to disability assessments and the negative impact that has had. I want to find a better way to understand people's mobility needs and ensure that people get the best benefits that they are entitled to. We want to get that right and we will be working with stakeholders and clients in the consultation to find a different and better descriptor on that issue. The cabinet secretary says that she expects the majority of people to be transferred by 2023 with and expects all cases to be fully transferred by 2024, which is not a guarantee of anything. Having said that all those benefits would be originally transferred before May 2021, that has now been kicked down the road, can she tell us what the extra cost of that horrendous delay will be? We will take full responsibility of all the developed benefits from April 2020 just exactly as we promised. I say that she expects to be transferred because that is a joint programme with the DWP. I cannot deliver the timetable without doing it jointly with the DWP, so I expect to be able to deliver that majority by the end of 2023. I expect to be able to do all the chancellars by 2024. It is not in my gift to do that. If the member would like to take that up with the Secretary of State and the UK Government to encourage them to deliver on our pace and change, then I would appreciate his support in doing that. Bob Doris, to be followed by Neil Bibby. I appreciate the time that Government officials took this week with me and Jeremy Balfour to talk us through the complexities of the social security programme. I was struck by the scale of the programme and the new systems that are required in the IT being built. It was very impressive indeed. Have you learned lessons from other large-scale public sector projects or Audit Scotland, which is regularly reviewing the programme? After all, getting this right first time is the best way to deliver for claimants. Bob Doris is quite right to point to the fact that we need to get this right first time for everyone involved, because those are people who are relying on us to ensure that their payments come through. That is why, as we have said right from the start of the project under previous cabinet secretaries, safe and secure transition is our absolute priority. We are undertaking the largest and most complex programme of change since devolution. We are building a robust and future-proof digital system that delivers a high-volume payment and is a very complex task. We have learned from other major initiatives in recent times with our focus on reuse before buy before build. It is an innovation in the public sector that is reducing risk in data duplication and providing value for money. It is in line with Audit Scotland's principles for a digital future. Regularly reviewing our programme structures and processes and adapting as we grow to change is also the right thing to do and good practice for any programme, as was highlighted by Audit Scotland in the report last year, as is the incremental approach to the development of social security. The Government's child poverty delivery plan to 2022 specifically says, within the first delivery plan that we are absolutely committed to introducing a new income supplement for low-income families. After today's statement with social security barely being devolved by that date, does the cabinet secretary honestly believe that the public and the estimated 300,000 children who will be living in poverty by then can trust that a single penny of the supplement will be in their pockets by that date when the Government has broken their promise to fully devolve benefits by the end of this session? I say once again that 15 per cent of benefit payments will be fully devolved in April of next year. The reason why the income supplement is not mentioned within the statement is that the statement today only refers to the benefits that are devolved under the Scotland Act. At the stage in which we are able to give a timeline, we have an undergone planning and delivery consideration. Members will obviously know that there is an option of rasals going forward to examine the potential policy and delivery options for the income supplement based on our two key principles of reaching the greatest number of children in poverty and ensuring a robust and viable delivery route. The commitment that is contained within the delivery plan is that we will work towards the introduction of the income supplement over the lifetime of the plan, and that is exactly what we intend to do. John Mason The cabinet secretary in her statement mentioned a new culture of dignity, fairness and respect. I wonder if she can say anything about how that will come into place so that we do not see examples, as we saw in the film I, Daniel Blake, where an ordinary member of the staff tried to help somebody claiming benefits and was jumped on by somebody from senior management. John Mason again raises the very important point that it is not the DWP staff that are to blame for the system but the UK Government that have the policies that they need to implement. We are determined to do things differently up in Scotland, and that is very much based on the social security charter and what that enshrined. It is a very powerful document because it has been developed not by Government but by those with lived experience of the social security system. It ensures that the Scottish Social Security Act principles that legally define our approach to social security, based on dignity and respect in human rights, are upheld in every single interaction that any individual has with our system. The cabinet secretary in her statement concludes her statement on the delivery of devolved benefits. A point of order from Jenny Gilruth. I seek your guidance on the standing order 7.3.1 and the code of conduct for MSPs. Today, at First Minister's Questions, at 12.29pm, Jackie Baillie claimed and I quote that discussions between Colleges Scotland and the EIS have broken up less than an hour ago. In reality, those talks were still on-going even when Jackie Baillie was on her feet and for some time thereafter. Ms Baillie also stated as a fact that no new offer had been tabled. That also turns out to be factually wrong. Some might suggest that Ms Baillie was attempting to deliberately jeopardise these crucial talks with her carefully timed intervention at the most sensitive moment possible. In relation to standing orders and the code of conduct, can you therefore advise what responsibility now rests on Jackie Baillie to correct the official report? Thank you very much. I also thank Jenny Gilruth for letting me know that she wished to raise a point of order at this point of proceedings. The member has made a point and I recognise that she wanted to make that point. I hope that she takes some comfort from the fact that it might have been the official report. However, that is not a point of order for me to rule on. I do not believe that the question that she asked me is one for me to consider but one for her to consider on the member. On that note, we will move on to the next item of business, which is debate on motion 16038 in the name of Fiona Hyslop on the Census Amendment Scotland bill. I will just take a few moments for ministers and members to change seats.


Dr Alex Vodak is the leading expert on harm reduction in Australia. He explained us what the world can learn from Australian drug policies. The needle syringe program began on November 12, 1986 in Sydney and then spread from that state, New South Wales, to all the other states over the next two years. And it's been very effective. HRV rates have been very low among people who inject drugs by international standards rising a bit recently. Hepatitis C rates were very high, but they've halved in the last 15 years. There are still some very significant gaps. We don't have harm reduction throughout the whole country within our correctional system. So drugs are available, of course, like in the rest of the world. Very high-risk injecting practices in the prisons. Harm reduction services don't really get to the people who need them most. The people who are most socially disadvantaged, economically disadvantaged, indigenous people, people from ethnic communities. And unfortunately, the federal cabinet in this city on August the 19th, 1997, decided that we wouldn't have heroin-assisted treatment. So we badly need that. We've still only got one safe injecting centre that's in Sydney for a country of 7.5 million square kilometres, a big country, a population of 23 million people. And we probably need a dozen or so safe injecting facilities around the country. And we still have only had one going since 2001. We need more. I would say to the Prime Minister that the criminal justice approach has failed. It gets 66% of government expenditure. The taxpayer gets a very poor return on that considerable investment. That's about $1.1 billion a year that gets spent on customs police, courts and prisons, those sorts of things. And really, the area has to be redefined as a health and social initiative primarily.