## Saturday, 20 July 2019

### Encoding Signals

Well, now that we have looked at how we turn sound into numbers, or computer data, lets see the methods that we can use to actually transfer this data from one point to another. Well, when it comes to sound you can shout, but the thing is that there is only a certain distance that the sound can reach before it becomes almost impossible to hear.

Let us use the example of a message. Say we write a message down on a sheet of paper. Now, there are a number of ways we can send that message. Obviously you could hold it up, but that wouldn't be all that good since you will need to be pretty close to be able to read it. Secondly you could throw it, but if you have ever attempted to throw a piece of paper, you probably know how futile a task that is. Well, you could screw it up and throw it, but that would increase the distance only slightly. The next option is to turn it into a paper aeroplane. Well, that might actually increase the distance, depending on a lot of factors such as wind, and whether it is raining. The final method would be folding it up, placing it in a envelope, and putting it in a letter box. From there it gets placed on a motorcycle, and depending on the destination, even on a plane. Well, it looks as if we can now send our message a considerable distance.

You might be wandering why I went through that example, and honestly, I am sort of wandering about it myself, though I do tend to have this ability of rabbiting on about nothing in particular, except that there is a method to my madness. As you can see, a message in its basic form can't really travel all that far, however if we attach it to something else, such as a motor bike, or a plane, then suddenly this message can travel, comprehensively, a lot faster. This is the same when it comes to data. One of the terms used when it comes to attaching data to a signal is modulation, another term is encoding. Actually, encoding is a term used more for digital data, since it is a way of mapping the digital data, that is made up of 0s and 1s, onto a signal, and there are a number of ways to do this.

Actually, encoding will output a digital signal, while modulation will output an analog signal. This usually occurs where the medium that is transporting the signal can only handle analog signals - wires are an example of this. We also have a couple of other things I should mention:

Unipolar: This is where the signal exists in a single state, either positive or negative.

Polar: This is somewhat different, in that the signal changes state based upon the logic value of the data. So, a 1 might be positive, and a 0 might be negative.

Differential Encoding: This occurs where the data bits are represented by changes between the elements as opposed to elements themselves. An example would be where a 1 represents a -ve to a +ve change, which a 0 represents a +ve to a -ve change.

Ratio: This refers to the number of data elements that are carried by a single signal element. The table below should be helpful in this regard.

#### Digital Data, Digital Signals

Now, this is where the fun begins. There are a number of ways to transmit digital data, and we will be looking at a few of them, as well as including a number of diagrams. I think that a list might be better here:

• Return to Zero: There are three voltage levels, +ve, -ve, and zero. The signal returns to zero in the middle of the pulse, and is either high to zero, or low to zero.
• Non-return to Zero: The signal doesn't return to zero in the middle of the pulse, though there are a few ways that it can be done:
• Non-return to Zero Level (NRZ-L): here we have 0 as the high level, a 1 as the low level.
• Non-Return to Zero - Invert on Ones (NRZ-I): Here if the signal is a 0, there will be no change, but if the signal is a 1, then it will invert. This occurs at the beginning of the signal.

With the Non-Return to Zero, both are easy to implement, but the problem is that there is no synchronisation, and there is no error correction. Further, there is a lot of needless changing.

Biphase Encoding
The difference here is that each of the segments has a transition in the middle, which is a means of self clocking and synchronising. The transitions at the period boundary do not mean anything, there are only there to place the signal into the correct state.
•  Manchester: This is a mix of return to zero and NRZ-L. For a zero it transitions from high to low in the middle of the segment, and the opposite for a one.
• Differential-Manchester: This combines the RZ and the NRZ-I. Basically at the beginning of the segment there is no transition for a 0, and a transition for a 1.
The benefits is that they have only two voltages, +ve and -ve, they allow for self clocking. The problems is that once again there is no error checking, there is no functionality for DC (direct current), and the multiple changes require a wider bandwidth.

Bipolar Encoding
Here we have three voltage levels, +ve, -ve, and 0 to represent our bits. There are two forms: Bipolar Alternate Mark Inversion and and Psuedoterenary.
• Bipolar AMI: 0 represents no line, or a zero voltage, while 1 is either a +ve or a -ve. The voltage alternates for successive ones.
• Pseudoterenary: Well, this is basically the opposite to the above.

#### Analog Data, Digital Signals

This is the process of turning analog data into a digital signal, otherwise known as digitisation. The benefits for this are numerous, including that there being no need for an amplifier, but rather a repeater. Amplifiers are problematic since while they can amplify the signal, they also have this habit of amplifying any noise that is with the signal. In fact it allows more efficient use of digital switching techniques, as well as being able to use Time Division Multiplexing as opposed to frequency division (more on that later).

Analog signals are digitised using a system called pulse amplitude modulation, and pulse code modulation is the most common. Samples are taken at around 8000 samples per second, and are usually recorded with an 8 bit depth. This will result in a digital rate of 64000 bps (namely 8 * 8000). For standard voice grade circuits, this is usually done at 3300 samples per second.

Instead of going through all the details, this image probably says it all:

#### Digital Data, Analog Signal

Well, even in our digital age, it is still necessary for us to be able to transmit digital data along analog lines - such as the telephone lines. In fact the NBN requires a digital to analog conversion, since fibre optic only allows analog signals. So, to do this you need to modulate the digital data onto the analog signal, normally by combining the signal m(t) onto the carrier frequency fc, to produce the signal s(t). The bandwidth is usually centered on the carriers frequency.

So, how is this done? Well, there are a couple of ways:

Amplitude Shift Keying
Here, the binary values are represented by two different amplitudes of the carrier frequency. A 0 will be, well, 0, but a 1 might be the actually sine wave - s(t) = Asin(2πft).
It might be better to have a look at it as a diagram:

Frequency Shift Keying
This is another way of doing it, so that while the amplitude stays the same, the frequency changes:
0 = Asin(2πf1t)
1= Asin(2πf2t)

Phase Shift Keying

This is where the phase of the signal is shifted to represent 0s and 1s. Differential phase shift keying shifts the phase relative to the previous transmission as opposed to some reference signal.

0 = Asin(2πft).
1 = Asin(2πft+θ).

#### Analog Data, Analog Signal

Okay, this is the final one, and it is probably still around, if Alan Jones' antics are anything to go by (he is a radio announcer in Sydney, well known for his rather controversial statements that tend to get blown all out of proportion by the media).

There are two types: Amplitude Modulation and Frequency modulation. Basically the data is mapped onto the carrier signal in a way that either leaves the frequency the same and changes the amplitude (AM) or leaves the amplitude alone and changes the frequency.

Once again, pictures probably say a lot more than words.

So, this is amplitude modulation:

And finally, frequency modulation:

Encoding Signals by David Alfred Sarkies is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. This license only applies to the text and any image that is within the public domain. Any images or videos that are the subject of copyright are not covered by this license. Use of these images are for illustrative purposes only are are not intended to assert ownership. If you wish to use this work commercially please feel free to contact me

## Wednesday, 17 July 2019

### Security Protocols & Authentication

Well, it seems that this word protocol has once again raised its ugly head. Well, that may be a bit too harsh to refer to protocol as having an ugly head, but the thing is that this seems to be coming back again and again as we move through these topics. However, in this instance the word security comes before the word protocol, so I guess what we are looking at is that when we access something, such as Facebook, we can prove to Facebook that we are who say we are, and just as importantly, Facebook can prove to us that it is who it says it is.

So, we have two concepts here - Authentication and Authorisation. Basically authentication comes down to you proving who you say you are, and authorisation comes after authentication, and that namely comes down to determining what you are allowed to do. For instance are you a guest, a vendor, or even a systems operator. In many cases sites will take a layered approach, namely if one layer fails to prevent an attack, then another layer is there to attempt to foil the said attack. However, intrusion detection is something that we will cover in the next post. Yet, this image probably says a lot:

Authentication can be based on something that you know, such as a password, something you have, such as a key card, or even something that you are, such as your fingerprint, or even your retina pattern. The thing is that each of these have benefits and flaws. For instance, passwords have the strength in that they can be changed if they are compromised, or forgotten, however they are actually one of the weakest forms of protocol.

The thing is, many people are really, really bad when it comes to passwords. If the only symbols used in passwords are letters, and the password is 8 characters long, then that is 268, or 208,827,064,576 possible combinations. Say we use a mix of upper and lower case letters, then that is doubled to 5.35×10¹³ possible combinations. Throw in numbers, and then you get 1.92×10¹⁴ possible combinations. However, if you have a brute force attack which basically tries every single combination of the password, and it is able to attempt 100 passwords a second, then it will take 60 thousand years to crack that password.

Well, we can also have what are known as items that we need, such as your Visa Card. Sure, you need to be in possession of that card to access your account, but the thing is banks these days are making it easier to access your account without it - all you need is a mobile phone. How about that access card for your office. Well, the problem with these is that they can be lost. In fact, I suspect people still do not treat mobile phones as the serious security risks that they actually are. Does a random person come up to you, give you a sob story and asks if they can use your phone to make a call? Will you let them use it. Me, I'd point them to the nearest phone box, and maybe give them 50c to make the call.

So, the final thing we have is biometric protocols, that is something physical about who you are. The most common one happens to be finger prints. Okay, there are a lot of others as well, such as facial recognition, retina scanning, or even hand prints, but let us have a look at how fingerprinting works:

A lot of these systems work similarly. Basically an image is taken of the fingerprint, it is then enhanced, and certain parts of the finger print are then recorded. Once this is done, the sections are then stored on file. So, when you then place your fingerprint on the scanner, it will match your fingerprint with that which is stored on file. The problem is that finger prints aren't necessarily all that different, and can change, especially if you suffer an injury. This is the same with facial recognition because your face in one sense changes as you grow older, but in other cases it stays the same, or at least the bone structure, which is what is recorded, stays the same. As for the iris, well that is incredibly chaotic, no two are the same, and they do not change throughout a lifetime. Well, apparently it is possible to fake an iris, but that seems to be in the realm of science fiction.

#### Protocols on the Computer

Well, we all have protocols, such as asking a question in class - we raise our hand and wait for the teacher to point to us. There are networking protocols, such as FTP and HTTP, as well security protocols such as SSL, IPSec, and Kerebos. However there are flaws, and some of these flaws can be particularly subtle. For instance, there may be implementation flaws, or simply flaws in the actual way the protocol works. However, a security protocol needs to be efficient, robust, easy to use and flexible. For instance, it needs to require minimal computational requirement and use minimal bandwidth, yet needs to be able to resist an attacker, or still work when the environment changes. Basically, trying to balance these factors out is the key.

So, we have Moss, who is attempting to access the Benhom industries server, and there are a number of ways that the protocol can operate. Now, Moss needs to prove to Benhom that he is Moss, but since Moss isn't stupid, he should also require Benhom to prove to him that it is actually Benhom. In order to do this a session key needs to be established. However, there are other keys as well, such as public/private keys, hash functions, and symmetric keys. Yet sometimes there is also a requirement for anonymity and plausible deniability, such as when you, well, want to visit that website.

Now, authentication on a stand alone computer is relatively simple, namely you just need a password. However, authentication over a network does get somewhat more complicated. Sure, attacks on authentication software, such as keyboard logging, are an issue with standalone computers, but honestly, the only way somebody is going to be able to access your desktop is to break into your house (though laptops are a completely different story). With a network this is vastly different since attackers can passively listen, and also use what are known as replay attacks.

So, we have the following simple protocol:

This is okay for your laptop, or your desktop, but not so much for accessing a site like Facebook. For instance, Bob needs to know Alice's password, and Trudy (who is the attacker) could be sitting there passively listening to what is going on. For instance, Alice has a keyboard logger on her computer, so when Alice enters her password, Trudy captures it, and can then use her password to access Bob.

Well, this can be prevented by having Alice enter her username and password as soon as she requests access. Yeah, that might work, except remember, Alice has a keylogger on her computer, so Trudy is basically listening into what is going on, and can then use Alice's details to access her account.

You could Hash Alice's password, so that neither Trudy, nor Bob, actually know the password, except the problem is that it is still subject to a replay attack. Further, If Alice has a key logger on her computer, then Trudy can easily hash the password, or she can simply send the hashed password directly to Bob to allow access. So, there is a problem.

So, what we have is the challenge-response scenario. Basically when Alice requests access, Bob replies with what is known as a Nounce, or number used only once. So, when Alice replies with her password, the password is hashed, with the nounce. This will actually defeat the replay attack since the hash will pretty much change every time that Alice requests access. However, there is still the problem with the keyboard logger, namely because if Trudy knows Alice's password, then it doesn't matter what the nounce is, Trudy can always gain access (unless Alice removes the keyboard logger and changes the password). The other thing is that Bob must know Alice's password to be able to reply.

However, there is a better way than a hashed password, and that works with encryption. The thing with a hashed password is that if Trudy intercepts the password, then she can use the hash to gain access to Bob on behalf of Alice. What needs to be done is that the password is hashed once it reaches Bob so that Trudy does not actually know what the hash is. This is done through generating a key, whether symmetric or asymmetric. Basically the password is encrypted, and then sent to Bob, who then decrypts the password and then hashes it.

Yet there is still a problem. Sure, Bob is able to Authenticate Alice, but what if Alice wants to authenticate Bob. Surely Alice needs to know that she is actually sending her password to where she actually wants to send it as opposed to some imposter that has basically copied the bank's homepage and created a replica?

So, we have here Alice requesting a reply from Bob, Bob replying with an encrypted reply, and a key, and then Alice responding. Well, that seems to work, but the thing is that Bob isn't actually authenticating Alice. Sure, Alice knows that Bob is Bob, but the problem is that Bob doesn't know whether Alice is who she says she is - she could be Trudy.

While we have a secure one way authentication protocol, we don't have them authenticating each other. So, could the solution be to have a two way authentication protocol where both parties are authenticating each other?

So, Alice requests authentication from Bob. Bob responds with an encrypted authentication reply, with a key, and a request for authentication from Alice. Alice then sends the authenticated reply back to Bob. Well, that looks like it could work, except there is one major flaw - Trudy could open two sessions.

Basically, Trudy sends an authentication request and receives the encrypted reply, with Bob's authentication request. Now, remember, these keys are symmetric, meaning that they are the same on both sides. Now, Trudy has Bob's authentication request, so in a second session, Trudy sends the same request to Bob, who responds with an encrypted reply. Suddenly, Trudy now has the encrypted reply (she doesn't know the key), and she can then send it back to Bob, and thus gain access.

So, while our one way authentication may be secure, it isn't secure when we are using it for mutual authentication. This is the problem with protocols - they can be incredibly subtle, and while they may work in one scenario, they won't necessarily work in another. The other thing is that attackers are very, very resourceful. In fact they may even have the resources of entire governments behind them, so we need to be wary. Another problem is when environments change - what may work on a desktop in an office does not necessarily work when you are logging onto the office network from a remote location.

Well, we have now included the identity within the nounce. So, Bob replies with his identity, and Alice responds with hers. This seems like it will defeat the above attack, since Trudy should not be able to replicate Alice's identity.

Another way is to use the public/private key encryption. Basically everybody knows Alice's public key, but only Alice knows her private key. We can also use digital signatures as well. That this for example (where M is the passphrase):

[{M}Alice]Alice

here, Alice encrypts the password {} and the signs it. Or:

{[M]Alice}Alice

While this looks okay, once again we are back to the problem of mutual authentication. Basically, Bob is authenticating Alice, but not vice versa. In this situation Trudy can basically get Alice to decrypt anything.

In this situation, Trudy has previously intercepted a message signed with Alice's public key. As such, she can then use the public key to get Alice to decrypt something and then send it back to her. This is another flaw with the public/private key algorithm - you should never use the same public/private key pairs for both encryption and signing.

The same is the case where Bob requests Alice to sign something, Trudy can basically get Alice to sign anything. What we want is mutual authentication - if Alice is unable to authenticate Bob, then the problem arises that Trudy could impersonate Bob and then get Alice to basically provide anything that she wants off of Alice.

One way to do this is to use a session key, namely a symmetric key that is only active for that particular session. Basically there is authentication, and once that authentication is complete, then a session key is shared. Without the session key, Trudy does not have access.

Well, this looks secure, where Alice sends a Nounce to Bob, Bob replies with an encrypted key using Alice's public key, and Alice responds with a with Bob's public key. Yet there is a problem - Alice's nounce R does nothing to authenticate Bob. Sure, Alice is using Bob's public key, but there is no response from Bob - the nounce is in fact useless.

Well, Bob could instead respond by signing the reply, expect there is a further problem - the signature does not actually encrypt the session key, so it is exposed for an attacker to be able to see it. So, let us try this:

Well, it looks like we have solved it here, except that this is subject to a Man in the Middle attack:

In this situation, Trudy can get [R,K] from Bob, while Alice believes that she is actually communicating with Bob. However, what if instead on signing and encrypting, we encrypt and sign? Such as this

[{R,K}Bob]Alice

Well, the problem here is that anybody can see {R,K}Bob so unfortunately that isn't going to work all that well.

We can solve that by using a time stamp, which also works as a nounce. They can prevent replay attacks, and reduce the number of messages being sent back and forth. However, the problem arises in that not all times are synchronised. Thus we need to take into account what is called 'clock skew' yet by taking that into account we can suddenly open ourselves up to replay attacks.

As mentioned, they can be subtle, for instance signing and encrypting with a nounce is insecure, but encrypting and signing with a nounce is secure. However, if we use a time stamp, suddenly the opposite becomes true - protocols can be very subtle, and it really does depend on what we are using.

What we need is perfect forward security, namely a situation where if a message is intercepted, it cannot be used later - basically the attacker needs to act within a certain time, or else the information is useless. In many cases it really depends on the situation - access to an office desktop is going to require different protocols than, say, accessing Facebook. Also, the complexity really needs to depend on the type of data that is being stored - access to your bank is probably going to require different protocols than, say, access to a news site, or Netflix. It really does depend on the situation.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. This license only applies to the text and any image that is within the public domain. Any images or videos that are the subject of copyright are not covered by this license. Use of these images are for illustrative purposes only are are not intended to assert ownership. If you wish to use this work commercially please feel free to contact me

## Sunday, 7 July 2019

### Power Vacuum - King Lear's Resignation

Well, it seems as if Sir Ian McKellan is in the position where he can simply do what ever he wants, well when it comes to the theatre at least. Apparently the Chichester theatre approached him and asked him if he would like to do a play, and then proceeded to ask him what play he would like to do, considering he is one of those actors that has probably played every role out there. Anyway, he said that he wanted to give King Lear another shot, and fortunately for me, this particular production appeared on the National Theatre Live listing. The thing with King Lear is that a few years back I saw this awesome National Theatre production but unfortunately is just is not available beyond the fact that I saw it in a cinema. That was back before I actually started writing this blog. Further, I do have a version of King Lear staring McKellan on DVD, but honestly, it actually isn't all that good (though I will probably be burnt at the stake for making that comment).

So, it was with a little reservation that I decided to go and see this production. Look, don't get me wrong, I love Ian McKellan, not that I have seen in him all that much beyond the X-men, Lord of the Rings, and a National Theatre Live production where he and Patrick Stewart performed a Harold Pinter play. I guess it happens to be one of those things, like a Midsummers Night Dream, where I saw a production years ago by the Royal Shakespeare Company, and thought that it was so well done that I simply could not go and see another version of it. Well, I didn't, not for a long time, and I even avoided watching the more recent film version as well. Okay, I have since seen it again, and will probably be seeing another version of it shortly, but with King Lear, despite it being one of my favourite plays, the fact that the version I saw was so good, that I wasn't sure that even the venerable Ian McKellan could out do that.

Well, it turns out that I was quite wrong. This version of King Lear was nothing short of awesome, and McKellan was outstanding, but then again I am not really all that surprised. Okay, the play was performed using modern costumes, but that seems to be pretty much the done thing these days, though that doesn't actually seem to be the case when it comes to The Globe. Then again the Globe is The Globe, and as far as I can tell, authenticity is what they are on about there.

#### The Play

Look, I could go on about the play itself, but I feel that I have already done that elsewhere. The thing is that we probably already know the story quite well, you know, about how a king wants to retire, decides to divide his kingdom into three, but since his favourite daughter does not pander to his feelings, he kicks her out of the country and instead gives the country to his two remaining daughters. The rest of the play is basically his, and his country's, descent into madness. The play basically ends with literally half the cast dead, and the country once again without a ruler.

So, where did the story come from? Well, it appears that the story can be traced back to the History of the Kings of Britain, though this isn't the story that has come down to us in Shakespeare. Well, I doubt that Shakespeare built the play out of that rather short account, but rather was inspired by numerous other renditions that had been produced over the period. The subplot including Edgar and Edumund, which a part of me feels isn't actually a subplot because the entire play is a coherent whole, is the story that was added later to produce the form that we currently have.

The thing is that Shakespeare is hardly original. Sure, there are all these arguments about Shakespeare not actually being Shakespeare, but I'm not sure if people really understand what is going on. What he is doing is taking stories that had been around for quite a while and then adding his own flare. You know how we all hate remakes in Hollywood? Well, it turns out that Shakespeare was the grandfather of all remakes, it is just that his plays survived where was many of his sources disappeared into the mists of history.

Speaking of Hollywood, I do wander whether they could really produce a film like King Lear, and if they did whether they would alter it to make it more appealing. Honestly, this is a very unappealing story, but the reality is that it is always a very moving story - I always cry at the end, whether it be because Cordelia dies (and the first time I saw that scene I was struck dumb), and then when Lear dies because basically he has lost everything. Then there is the French invasion where they attempt to remove the tyrants from the throne of England. Well, they lose, but then again, they do happen to be the French, and surely Shakespeare couldn't have a play where the French actually won, even if they were lead by the good guys, and they were attempting to overthrow the bad guys.

#### A Country without a King

While we might suggest that it was a bit silly of Lear to actually divide up the country between his daughters, the reality is that this wasn't all that uncommon. The whole first born inheriting the entire country is a relatively new phenomenon. In fact, during the middle ages, or at least during the time of Charlemagne, it was quite common for the kingdoms to be divided between all of the children. This obviously doesn't result in a particularly stable system of passing on the title to the country, since the lands will get smaller and smaller as time, and generations, progress. Yet, at the time, or at least at the time the play is supposed to be set, this wasn't necessarily an absurd idea.

However, there is also this idea of the females inheriting the throne. Once again, this isn't necessarily an absurd idea, particularly since England was ruled by a queen (in fact there had been two queens in recent memory). Yet it is a little unclear as to where the power actually lay. Did it lie with Regan and Goneril, or did it lie with their husbands. Honestly, Albany and Cornwell simply aren't a couple of guys that happen to be playing second fiddle to the daughters - they have a role and a function of their own. Cornwell is a pretty brutal character, particularly since he is the one who gouges out the eyes of Glouscester. As for Albany, well, it actually seems to be the more honourable one, though he is completely dominated by his wife right up until the end.

Yet let us consider the idea of this power vacuum. From the point where Lear sets down his crown, it appears that there is a throne waiting to be claimed. Sure, the daughters aren't necessarily fighting amongst each other to claim that throne, but they have other concerns in the front of their mind. This is why I don't consider Edmund to actually be a subplot, but rather a character that is at the front and centre of the action. He sees what is going on, and he sees a way where he can climb the ladder to take the throne for himself.

This inevitably happens when there are power vacuums. It is interesting to note that the daughters are pretty quickly attempting to strip Lear of his retinue, until such a time as he only has two faithful followers, and one of those followers is a fool, and a fool that is not afraid to actually say it like it is. The thing is that these daughters don't necessarily appear to be particularly strong rulers, especially since Edmund is playing in the background to seize power for himself. He first of all gets rid of his brother, then his father, and finally brings himself into a relationship with both of the daughters, with the intention of dispatching both of them. In fact he poisons Regan near the end of the play, and no doubt intends on dispatching Goneril as well once Albany is out of the way.

#### A King of Fools

So, what is the problem with King Lear. Well, it is clear that he is a bit of a narcissist. He panders to those who tell him what he wants to hear, and banishes those who speak the truth to him. At first I simply thought he was somebody who wants to be loved, but the reality is that when one has been in a position for so long where he is surrounded by yes men it means that one simply cannot stand to hear anything other than yes. The reality is that to deal with such people you have to tell them what they want to hear, but the thing is that if these people have all of the power then maybe doing so isn't necessarily going to assist you in your progression, but on the other hand maybe it will.

The problem that Lear faced was that due to his narcissism, he gave up all of his power to people whom in reality he couldn't trust. This is the danger. Since he only listened to those who would heap praise upon him, and since they knew that that was the way to get ahead with him, once he had dispensed his of his power, he simply wasn't able to do anything once they turned against him. In a way, he ended up becoming a king of nobody but a couple of fools. In fact you could attribute this to his descent into madness. His narcissism at the beginning of the play resulted in him being stripped of everything that matters to the point that he was wandering alone around the country side handing out flowers to anybody who would listen.

People have suggested that maybe Lear was suffering from Dementia, and at first I thought that this was a reasonable theory. However, I'm not entirely all that sure any more. The thing is that we are watching a man being stripped of everything that made him who he is. He thought that it was time to retire, and in fact that is probably quite reasonable, and smart, since he was getting rather old. However, it becomes pretty clear that he is not thinking straight. Well, not quite, because it seems that he is seeking praise and simply will not settle for anything less.

Yet with this mind set, he begins by fighting with both of his daughters, and then finds himself excluded, wandering around the moors drenched in the rain. Sure, he picks up poor Tom, who is actually Edgar in disguise, but he has literally become a man with nothing. This is the nature of Shakespeare's genius - he understands human nature, and understands what it means to be a narcissist, somebody who will only respond to praise, and will banish the critics. When everything is stripped away from them all that is left is madness.

In many cases we are all like that. I've been there, where people have tried to speak to me to help me understand my flaws. Yet the problem is that sometimes it is really difficult to differentiate it from those who are genuinely friends, and those who are only attempting to get a leg up on us. The reality is that everybody wants to offer us advise, and sometimes that advice simply isn't going to be good advice. In a way we need to learn to accept criticism, but to also be able to retain a semblance of free will so that we will not become dominated by people who seek to dominate us.

A part of me was wandering whether it is possible for me to write multiple posts on a single Shakespearian play. Well, it certainly seems possible because with every play we watch, and every time we watch a play, we will certainly see something different, and certainly be able to draw more out of it that we weren't able to draw out of it previously. One thing that I know is that there is more that I want to write about here, but at this point in time what I actually wanted to write about has completely slipped my mind. Oh well, I guess there is always another production of King Lear out there to watch.

Power Vacuum - King Lear's Resignation by David Alfred Sarkies is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. This license only applies to the text and any image that is within the public domain. Any images or videos that are the subject of copyright are not covered by this license. Use of these images are for illustrative purposes only are are not intended to assert ownership. If you wish to use this work commercially please feel free to contact me

## Sunday, 30 June 2019

### Quantisation - Sampling the signal

I'm sure we have all heard of the concept of sampling, namely where we convert an analogue sound into digital sound. Actually, this was something that was bandied about when I was much younger, and seemed to refer to when you would take parts of songs and then meld them together to create a different song, much in the way many of the electronic musicians would do. However, in the world of data comms it is where we convert an analogue signal into a digital signal, and it usually involves sound, namely because that is the easiest.

Actually, the best way to describe how it is done is to actually show you, so let us consider the graph below (from my lecture notes, though I not will mention that from this point on, if I don't source the image, then it is either public domain, or from my lecture notes):

 Actually, it looks as if it came from wikipedia: By Aquegg - Own work, CC BY-SA 3.0,
What we see above is an analogue signal with a number of blue spots on it. These spots are where we are mapping the signal. Now the whole idea of this is to digitise the signal, send it across some medium, and then when we reach the other end reproduce it as faithfully as possible.

So, the signal is being mapped as above, and at each of the points we make a record of where the signal is on the graph. As we can see, the bit level is actually 16 bits, so each of the points are translated as follows: -4, 0, 4, 7, 6, 3, 0, -1 ...

Now, I should mention sensitivity - basically that involves how close to the original signal we actually are - the greater the bit depth the more accurate the signal. I'm not sure if you actually know what a ruler is, but it is basically a length of wood (or plastic, or metal) that has two straight edges and a series of markings along the side. As well as being used to draw margins down the side of our paper in primary school, rulers were also used to measure length. Now, the sensitivity of the ruler was determined by how far apart the notches were. So, a ruler where the notches were half a centimetre apart was a lot less sensitive than a ruler where the notches were a millimetre apart.

So, once we have sampled the data, we can then convert it into 0s and 1s, but this is automatically done by our computers, the only reason we would do this is if we were writing something down on paper, or doing something a lot more detailed than simply writing a program using javascript.

However, this brings us to another problem, and that is called quantisation error, or sampling error. Basically, depending on how sensitive our readings are, we may not actually be able to sample the sound as perfectly as we will like. In fact in some cases it might actually be off somewhat. The problem is that the more sensitive the sampling is, the more bit depth is required, and the deeper the bit depth, the larger the amount of data that will be produced. As such, there needs to be a trade off - smaller files produced a lesser quality while a greater quality produces larger files.

Now that we have sampled the sounds, it is time to transmit the sound across the medium. Once again we have this trade off - for a better, and faster, transmission we need a greater bandwidth, but greater bandwidth leads to greater cost. Yet, if we lower the costs by lowering the bandwidth, we produce not so much less quality sound, but also distortion. Look, that is probably not too problematic if we aren't listening to the sounds live, since we can buffer it, but when it comes to live transmissions, then we need the higher bandwidth.

The next problem we need to consider is how often we sample the sine wave. Consider the graphs below:

Looking above we can see if we take a sample every half frequency we basically get absolutely nothing. If we take it 2/3 of the frequency, we can something but it looks like it is simply going to be a jumble of noise. Looking at the next one, I'm not sure if the 'wave frequency' is correct, because if we took it at the wave frequency, it would be the same the half frequency. What looks like is being done here, is that it is being taken at four times the frequency, and the next one at eight times the frequency. Here we are getting a much better sample, though obviously the more we sample, the better we get, but the problem of the trade off then arises in that the more we sample, the larger the amount of data that is produced.

In fact, the sampling rate is also measured in hz, being the number of samples per second. So, once again, the greater the number of samples that are taken, the better the quality. The standard sampling rate is something along the lines 44,100 hz.

Finally, we have interpolation, which is the way that the sound is turned back into an analogue form. Now, if we simply relied on the sampling levels, we would get a blocky, and rather horrid, sound. So, interpolation is an algorithm that is used to make the wave as smooth as possible to reproduce the sound in the best way possible.

Oh, before I finish off, let us go back to our sampling at the beginning where we got the numbers: -4, 0, 4, 7, 6, 3, 0, -1.

Now, the next step is to write them down as positive numbers, so we will have 4, 8, 12, 15, 14, 11, 8, 7. Now that we have done that, we convert them into binary, however because the graph went from -ve to +ve, once we have done that we need to then place another bit in front of them where 0 represents negative, and 1 represents positive.

Quantisation - Sampling the signal by David Alfred Sarkies is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. This license only applies to the text and any image that is within the public domain. Any images or videos that are the subject of copyright are not covered by this license. Use of these images are for illustrative purposes only are are not intended to assert ownership. If you wish to use this work commercially please feel free to contact me

## Saturday, 22 June 2019

### Stenography - Data Hiding

Well, you could tell me that it was painted my Leonardo da Vinci, it is located in the Lovre, that it draws so many crowds on a daily basis that it is mind boggling, or that the only reason that it is actually famous is because somebody stole it back at the beginning of the 20th century. However, what if I were to tell you that there happens to be a message hidden in this painting? No, I am not talking about the Davinci Code, but rather I am speaking about a form of cryptography known as stenography, or data hiding. This is the process of hiding a message inside something so that the message cannot be seen.

The example that our lecturer gave us was that back in the days of the Ancient Greeks, when they wanted to send a message they would shave the head of a slave, tattoo the message onto the head of the slave, and then let the hair grow back again. Honestly, that doesn't sound all that practical since it takes quite a long time for hair to grow that by the time the message was be sent, the war would be over. Still, it is an ancient example of stenography.

The benefit that stenography has over cryptography is that the message is basically hidden in plain site. Cryptography has us scramble the message with a key, but the thing is that if the message is intercepted, they basically know that there is something hidden because, well, the message is scrambled. However, if they intercept a bunch of family photos, they may not actually realise that hidden in these photos are a bunch of nuclear launch codes. Another example would be a situation in a prison. Say an encoded message is passed through from one cell to another, and the warden gets the message. Well, since the message is encoded, the warden knows something is up. However, say a book is passed through with a bookmark. Each of the prisoners has a piece of card with some holes in it. If the card is placed over the page where the bookmark is located, then suddenly the message is revealed - however, unless the warden knows of the existence of the card, then all he (or she) thinks is that the prisoners are simply sharing books.

In fact we can hide messages in quite a lot of things, whether it be paintings, audio files, or even the html code of a website. Basically the object in which we are hiding the message is known as the cover object, and when the message is hidden, the object becomes what is known as a stego-object. Then we have the stego-key, such as the piece of card in the prisoner example, which is used to retrieve the message. Finally we have the embedding and the extraction function, which is an algorithm used to place the message into the cover object, and then retrieve it once again.

Actually, there is more to stenography than just hidding messages in books to communicate behind the warden's back. It can actually be used for legitimate purposes. For instance we can hide patient data inside an ECG so that when it is sent from one place to another, all the information pertaining to the patient is already there. However, simply placing the data into the ECG isn't actually going to affect the ECG all that much, if at all.

Now, as I mentioned, there is more to hiding information than placing coded messages inside the Mona Lisa. For instance you can hide numbers inside numbers. In fact you can do it in a way that it doesn't even appear that there is any message inside the number. Take this for instance, Betty wants to hide the number 3 inside the number 14256. So, we convert it into binary:

3=101
14265 = 0011100010111110;

Now, we select three random bits in the number to indicate where we are going to hide them, and in this case they will be 6,11, and 15. So, the number becomes:

0011100010111110 = 0011110010011110 = 15518.

However, let us be a little sneakier and make the number 5,10,15:

0011100010111110 = 0011100010111110 = 14256.

As you can see, by selecting specific bits we can hide one number inside another number without it actually suggesting that anything is being hidden inside the number. The key, being 6,11, and 15, or 5, 10, 15, are passed using a secure channel, or are exchanged before hand.

Actually, you don't have to stick with one number, you can actually use multiple numbers, as such:

So, as you can see, we can manipulate numbers with numbers to be able to hide numbers inside numbers. We can also hide them in a way that it is not obvious that there is anything hidden inside the number. In fact, by manipulating the least significant bit the change in the value is so small that it can go unnoticed. It is this that allows us to hide information inside things like ECG scans. To make it even more secure, only certain parts of the ECG are selected to hide the information:

Now that we see how numbers can be hidden in numbers, and also when it comes to ECGs, we can now move on to the smiling Mona Lisa and question how we can hide a message inside that smile. Well, first of all you actually need a digital image of it, namely because I'm not entirely sure if the French will be all that happy if you attempt to hide a message inside the real Mona Lisa.

On a digitial image, colours are made up of the three primary colours: red, green, and blue. Each of them will have an intensity, so say we have three values, and each of these values are represented by a four bit number, so we have a value between 000 and fff (which represents 15,15,15). 000 is black and fff is white. The first digit is red, the second digit is green, and the third digit is blue.

We then convert these numbers into binary, so we have 0000,0000,0000. Now, like the ECG above, we basically change the least significant bit of the values, and all of a sudden we have a message hidden in the colours.

Just to give you a better example, have a look at the two words below.

Colour
Colour

Both of them appear green, don't they. Well, as it turns out, one of them is off by one single bit - can you tell when one it is? No, well, that is how data is hidden inside images, or colours (though since I am writing this on blogger, actually coding the colours in the html editor is rather painful).

Hopefully that image also explains a few things.

And, so it is just a short hop to actually hiding information inside webpages, particularly when you are hiding them in the colours, as I was doing above. However, the key is to be able to do it in a robust way. While it might be easy to hide the information, sometimes extracting it can be an absolute pain. For instance, I wrote a program in javascript that placed an image onto a HTML canvas, and then proceeded to manipulate the colours to hide a message. Well, that worked okay, except when we downloaded it, and the uploaded it back to the canvas to retrieve the message, it turns out that the HTML canvas function has a complete mind of its own, and will simply set the colours as it sees fit. As such, getting the values back is no small task (a task that I am still trying to figure out).

Stenography - Data Hiding by David Alfred Sarkies is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. This license only applies to the text and any image that is within the public domain. Any images or videos that are the subject of copyright are not covered by this license. Use of these images are for illustrative purposes only are are not intended to assert ownership. If you wish to use this work commercially please feel free to contact me

## Tuesday, 18 June 2019

### Harsh Criticism - The Misanthrope

The
Misanthrope

Honestly, I'm not really all that sure whether I appreciated the Bell Shakespeare Company bringing this play into the 20th Century in much the same way that they do with quite a lot of their plays. The thing is that while the idea behind a lot of plays are timeless, somethings seeing a performance set in the original setting is so much better than having to sit through another modern Australian adaptation. Yet the truth is that it is more than possible to have this play set in the modern period, and something having such a setting does bring to light the comedy that not only made Moliere so popular, but also brought him into a lot of conflict with the powers that be (of course, the pictures on the post are not from this particular version, namely because I prefer to keep things original).

I guess the other thing we need to be aware is that this place was written in 17th Century French, so I'm not entirely sure whether performing it as it was originally written would have gone down so well with Australian audiences. As such one does need to at least translate the play, though when they introduced it by saying that it was based upon Moliere as opposed to actually being Moliere, sort of rubbed me up a little. I guess it has something to do with seeing so many of these adaptations that a part of me yearns for some originality.

However, that doesn't necessarily mean that it wasn't a good play. Sure, the back that they pretty much over used the rhyming technique really, really started to get to me. Poetry is written by meter, not by rhyme, and in a way I feel that using rhyme is somewhat childish. Hey, Dr Suess, a poetic genius who wrote some incredible children's books didn't always use rhyme (at least I believe that is the case because I don't have any of his books on hand). However, while rhyme is one way of creating poetry, it is the meter that is the one that sets the amateurs apart from the geniuses.

Yet upon reading the little booklet that I picked up at the show I discovered that the writer felt exactly the same. The thing is that the French language, as beautiful as it is, really works well when it comes to rhyme, and Moliere used it extensively. However, he was also aware that this doesn't really come across in English, and a lot of playwrights, realising that using rhyming couplets can sound pretty lame, and childish, usually dispense with it and just stick with blank verse, as Shakespeare did. However, I have to admit that it really did eventually grate with me, but that might have something to do with the Australianisation of the play.

#### The Critic

So the story is about that person name Alceste. In the original he is male, whereas here Alceste is female. I don't think that is all that much of an issue though. The thing is that Alceste is a huge critic of basically, well, everything, and she gets herself into a lot of trouble when she decides to voice her opinion. The play opens with her in a lot of trouble, and she is there with her best friend when she is approached by another popular artist who wants to share a song with her.

Well, out pops a country and/or western number, and of course her best friend thinks it is marvelous. Not so with Alceste as she spends here entire time ripping it to bits. Not surprisingly the artist is somewhat put off by Alceste's criticism and storms out in anger, declaring that she has not her the last of him.

As it turns out, Alceste has a boyfriend, or should I say a lover. Well, if it was in the original French setting I think lover would be an appropriate term to use, but instead we are in the Australian entertainment scene, so I'm not sure where lover, or even love interest, is all that appropriate. I'm not sure if the term boyfriend is also all that appropriate since he seems not just be a bit of a flirt, but a lot of a flirt.

Well, that isn't all that surprising, since he is one of those boy-band singers - you know, like Justin Beiber. Well, that is probably a little unfair on Beiber since he is quite monogomous, but you know the character trope. The guy that has millions of adoring teenage fans, and is more than willing to play the field behind the scenes. Yet for some reason Alceste is attracted to him. I guess it is that Alceste is human after all. Sure, she is a really harsh critic, but she also has a softer side.

So, that is basically the play. It really has a lot to do with Alceste dodging attacks from those that she has criticised, her boyfriend playing the field, and others attempting to grab his attention. Mind you, it does all fall apart for both Alceste and her boyfriend, particularly when everything comes to light. Well, despite the fact that she is one enormous crank, she also has her admirers, but as is the case, when they decide that their current pursuits are simply not worth it, her admirer is suddenly interested in somebody else.

The play finishes with the boyfriend sitting down dejected, and no longer has the heart to sing with the passion that he once did, while Alceste has basically decides to walk out on the entire scene, which two of her friends chasing after her to make sure that she doesn't do anything silly.

#### The Criticism

This is the thing that makes me wonder though, because criticism is part and parcel of the entertainment industry. Okay, maybe I shouldn't think too hard about it, but in the original, being set in the French court, being a critic probably did a lot more to earn enemies than it would in today's circles. Sure, nobody likes critics, particularly when they disagree with our views. In fact, I generally ignore the opinions of professional critics when it comes to movies and books because they seem to be so far away from my opinion that it is simply not worth the time to either listen to or read them. Sure, there are people that do, but I am not one of them.

Okay, Alceste pretty much hates everything, and is an absolute nitpicker, but I'm not entirely sure whether this is something that anybody could rightfully sue her for. Sure, if the attacks were personal, were lies, and where designed to ruin somebody's reputation, then sure, there is defamation, but to provide criticism for a work of art, even if the criticism is always, and without fail, bad, then I'm not entirely sure whether that will work. Okay, there are some organisations out there that go out of their way to shut down criticism - McLibel is a classic example of that - but in the entertainment industry I'm not really all that sure.

However, we can't forget that Alceste is pretty harsh in her judgements, and being a misanthrope, you can be assure that she is going to get personal at times, and this is where I suspect the problem lies. She never seems to be happy with anything, and is always looking for some flaw to point out. Actually, I'm not entirely sure whether she would be able to survive if she did, but I guess that is the issue that is coming about. The thing is that in French society one was a noble whether others liked it or not, but in the modern entertainment industry, one can be dropped in a flash, and thus your career is over - you don't even need to be a Kevin Spacey of a Harvey Weinstein for that to happen.

Though there is probably a very good reason why Alceste remained where she was. Once again it is a club, and once you have been accepted by that club, then they are unlikely to drop you, despite you being as harsh as Alceste. The thing is that everybody knows what Alceste is like, and sure, you get these newbies coming along thinking that they can challenge her, but in reality she is a sticker - she isn't going away.

#### That Lover

Yet there is also the issue of Cymbeline, something that grabbed my attention the first time I read the play. You see, with a play entitled The Misanthrope, I was expecting something more along the lines of Timon of Athens as opposed to a comedy. Yet Alceste is in love, and is in love with somebody who surely would be the bane of her existence. Cymbeline literally represents everything that Alceste hates about the industry, yet they are lovers (for want of a better word). Okay, Cymbeline really seems to be playing Alceste for a fool, but one has to wonder why she actually sees in him.

I guess this is the crux of the play - it does not matter how bitter and critical Alceste is, she is still a human and is still caught up with human passions. I guess that is one of those questions that will remain unanswered for ever - why do people fall in love even though the whole idea of these two people being together is absolutely absurd. For all of Alceste's criticism of the industry not only is she a part of it, she refuses to walk away from it.

Interestingly we notice how Cymbeline is destroyed at the end of the play, when his shenanigans come to light. The thing is that he really is somewhat of a philanderer, despite the fact that he assured Alceste that he was not. Alceste eventually walks away, turning her back on the whole sordid scene, while Cymbeline is left a dejected wreck, not able to sing in the way that he sung before the truth was reveal.

This is something to take note of, because the truth really has that nasty habit of coming to life. Just think of that time when you were as far away from home as you could ever be, and you run into somebody that you know. That happened to me at the Hong Kong airport, and even happened to me in Sydney, as I was greeted by a friend who was running to the airport. The thing is that we don't know who is around, who is watching, and we certainly don't know when we will encounter somebody who knows us, or something comes to light that exposes everything about us. Sure, there is all this thing about privacy, but no matter how hard we try to keep things secret, sometimes somebody is going to walk in on us when we least expect it.

#### The Industry

One of the interesting things about the play was that the stage opened with it completely cluttered, but ended with pretty much nothing there. It seems as if the whole facade that was the entertainment industry was being stripped away. Yet it also had a lot to do with the things that we are able to hide behind slowly being taken away until who we really are is suddenly revealed. Cymbelene is exposed as a philander, and Alceste turns her back on the industry realising that there is nothing there left for her.

Yet is the entertainment industry like the French court of the 17th Century? Well, quite possibly. The thing is that entertainers today are like the new nobility. Sure, the politicians have the member's bar, and sure, we may dislike them and distrust them, but compared to what goes on in the entertainment industry, they seem comparatively tame. The thing is that entertainers can get away with quite a lot more than people in the more respectable positions. Wild parties and ostentatious living seems to be the norm where they are concerned.

Interestingly, many of the riches to rags stories out there seem to concern entertainers more than businessmen. It seems as if businessmen are able to restrain their spending habits, and not live as outlandishly as the entertainers do. I guess that has a lot to do with entertainers being in the lime light. They have a image that they want to uphold, and they are very visible people. As such, they tend to live a lot more outlandishly in attempting to maintain that image, where as the businessmen really seem to exist and work behind the scenes.

Harsh Criticism - The Misanthrope by David Alfred Sarkies is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. This license only applies to the text and any image that is within the public domain. Any images or videos that are the subject of copyright are not covered by this license. Use of these images are for illustrative purposes only are are not intended to assert ownership. If you wish to use this work commercially please feel free to contact me