Monday, 28 March 2022

The Cipher - chapter 2 (short story)

 chapter 1  | chapter 3 | chapter 4


The computer finished booting up. Cassie opened up the browser to get the code into her computer. She checked her emails too, just in case. There was an email with no subject from Phil. Typical.

“Not ASCII, not UTF in any form unless special characters are supposed to mean something, no other common type of encoding I can think of. I’ll check if it’s something super obscure.”

Cassie had been afraid of that. She copied the numbers into a ciphertext to a text file and looked at it.

acbb87bc41b48b4dbc5f9b5716a7199a0959422a802f11b27a98a5d4ff06451afe6d26b68e5d7d2cac34ce32061b744893602e363a31d0a2018dc136ef39515da7826548327b

8fc83ebc51c128282a958aba9c26561a780e7e832a1988d64987d807a489fd2bbd123457e85e2f159685a4be44939c92ee970608b64b347fe17d1c1d3113b37a007edfb51368054c5c3c2da3be8eed0a2cbe

ca5c634da7451865d5a41c08d7968fb67b41652a3a44920f1c7e4f979f1dc23c8e0db94b6e89b00cf8a42d11b514d073e5570e65d240a70c87041f6752ce4e11b6b59f221e55b1a1651d

First things first, she had to find the length of the lines. This was easy enough. She wasn’t going to count it manually – not with this many numbers to count. Instead, she let her word processor do it for her. 140, 164, and 148, counting it line by line. Cassie noticed right away that all these numbers were even. No, not just that. They were divisible by four. That was the largest common factor. This made it very likely that she would have to look at sets of four numbers, which was four hexadecimal digits, or two bytes.

Cassie typed this out in response to Phil and sent it.

The next step, then, was to split the text into groups of four.

acbb 87bc 41b4 8b4d bc5f 9b57 16a7 199a 0959 422a 802f 11b2 7a98 a5d4 ff06 451a fe6d 26b6 8e5d 7d2c ac34 ce32 061b 7448 9360 2e36 3a31 d0a2 018d c136 ef39 515d a782 6548 327b

8fc8 3ebc 51c1 2828 2a95 8aba 9c26 561a 780e 7e83 2a19 88d6 4987 d807 a489 fd2b bd12 3457 e85e 2f15 9685 a4be 4493 9c92 ee97 0608 b64b 347f e17d 1c1d 3113 b37a 007e dfb5 1368 054c 5c3c 2da3 be8e ed0a 2cbe

ca5c 634d a745 1865 d5a4 1c08 d796 8fb6 7b41 652a 3a44 920f 1c7e 4f97 9f1d c23c 8e0d b94b 6e89 b00c f8a4 2d11 b514 d073 e557 0e65 d240 a70c 8704 1f67 52ce 4e11 b6b5 9f22 1e55 b1a1 651d

With that, she had to look for repeats. She couldn’t spot any. This meant she couldn’t attack it with statistical analysis.

What if the order of numbers didn’t matter? If the order mattered, 4 hexadecimal digits would give 43680 possibilities. Very few languages had that many characters. If order didn’t matter, it would be 1820 possible combinations. That was still way too much for most languages. Besides, almost every group of four in this cipher was completely unique. That was way too many combinations for English, at least.

No, this had to be simpler.

She looked at her mails again. There was one from Jake. It was another cipher.

“Dany sent this to my phone just now. She’s enjoying herself thoroughly.”

fe3dab0a1169be5f0a97f14ac7ab3e90756740c5cb1fe9994d9857bdaecba9b6bda371757d8acd544229f359a081

84a9e142604651af01bb551fc2519974be57193caa4812515b25768f86100817cc954a86df5ca01ca4101580d04a896e8863f15a06024d7d0a8383392e7bd83a737f9a8afa07dd8f3c282165745add506e345b52a6222b3e4808c76c4a65f7251b9de9c68483a228a0664712796ac215717a3fbbe29c0998f105044d9f1b

115d417cfa57bebb524d9488e7563bd2dfc9a936d1b1588d7a83d81a48b950215a62c49bd4c0b91a93966c84841dfbc85b04ffcb6497c9be933f9e4252cfbc8ce93ff1abf8c0c62482a641b71e7a6311a3399d2d2e7730ba1dd56439f671c4931d0578a4c35f6b2f0e783db6c8bdb641956f98895f81b9b3432fda9f09a0fe18994b

 

That was a lot of text. Cassie checked the number of characters in each line again. 92, 252, 260. Again, all of them were divisible by four. This had to mean something.

Just then, she got another email from Phil.

“Converting them to denary numbers as is makes no sense, I’m afraid.”

That should have been obvious. The email continued.

“We were taught a little bit about encryption so I’m going to try to apply some of the common encryption algorithms to this problem and see if it makes a difference. Might be limited without a key though, and it's entirely possible it's theoretically impossible to crack in a reasonable time. It’ll take a while, but I’ll automate it.”

That would be possible, yes, and Phil would do the job better than anyone. He would likely to find the answer too – Dany was a computer science student like him, so she likely had the same sort of knowledge base to start with. After all, that was how she broke Lex’s puzzle a week ago – Cassie was already familiar with the things he used as keys in that puzzle. In this case, well, Phil had that advantage.

Staring at it wasn’t giving Cassie any ideas. She watched something instead. Actually, she did that for a couple of hours, went out to buy something for dinner, returned to her room, and watched something again for another hour while having dinner. Then she opened the computer again. There was an email from Phil.

“Put everything together, program is running. So far, I’m not seeing any results. Will nap while it runs. Ciao.”

Typical Phil. He had the ability to nap anywhere at any time, and as usual, he put it to full use.

Cassie stared at the numbers again. There was no flash of inspiration at once. Then it struck. Would it be just modulus 26 like with all regular ciphers? That was entirely possible. Also, everything being divisible by 4 could be a huge coincidence.

Or maybe it was padded out that way on purpose.

Cassie tried the numbers pair by pair.

The first pair, ac would translate to 172 in denary numbers. The remainder when divided by 26 was 16. Q was the 17th letter in the alphabet, or number 16 when starting from zero. This would still make sense.

The next, BB, gave the answer 5. That was a problem – 5 corresponded to F. There were no words that started with QF as far as Cassie knew. She decided to try another pair for good luck. The next pair, 87, gave 5 again. QFF? The next pair gave G. QFFG. This was not good, unless it was a double layered cipher of some sort.

Anyway, she could try to translate this my hand, or she could use Phil to do the translation for her. This was precisely the kind of thing he was good at. She dropped him an email and tried to find something to watch. She found nothing. She checked her emails just in case, and Phil’s answer was there.

QFFGNYJZGRZJWLZYJLOQYVRWSWJEVGRAUFMAMPVSQAYYGBMURSUCGXAGBLLCFFDPLAXUYTNSKGDLOOQTIEAMIAQOWBQZGGVFIHIHTRHSAJYQVVUDIIQRAQEVGIAXAXRVCDXTXSAWPZTAFYOITHIMDKSIUOVZLRYXFICIHUNATNXQGQQPCWBVDDMIMNDXGHUMOITRZUALVJOXCMLMFEFZEYARAZDIEHVFXD

That made absolutely no sense, but it was sufficient for a frequency analysis at the very least.

The distribution did not look too bad, but it didn’t look too hopeful either.

There was another email from Phil. “Cassie, this doesn’t look like a simple substitution cipher, the distribution of letters is all wrong. My program is still running and it hasn’t caught anything yet either.”

He probably reached that conclusion by some form of statistical analysis. He knew what he was doing, but Cassie wasn’t quite ready to give up yet.

Then, Jake sent yet another cipher.

226e8d44288c80bc87352674536e677c59a56f9efd9a37866534acaab75f467bbb0144bd9e9c16a6f237606a8560a914

83a3dac99938cec60412262f73ac8b6cfe2a102e45a0a0014306ad4d48af2828491af74ddb094363a667308fc008e6941e605a90dcd3b9aeb77fad963b0e4eac3eb951bcd574d823458946895e3cdb9e1836b908bb536a644f37de971921b915c037b9987e6d1b5044401ec8ad75

bb6e55c6b05b8683a533f72f7590ae7a2c7e635938373509eaaee0c2cdc00daf2f59f4ca053fa705eca8729eef1fb876d939

42c3e9a44988d839bd9fe777559e4e4a4f0631a7024e953e997dd90a1f226521cfae237200357d9100cf1373f34ebc452a716755707a45ae726e5619

 

The lengths of the lines in this were again 96, 220, 100, 120. Again, all of these were divisible by four. This could not be a coincidence. This had to mean something.

Could it be a four-digit number in hexadecimal? No way. That was way too much information for a letter of English. As far as Cassie knew, Dany spoke neither Chinese nor Japanese, or any other language that would need so many characters. Okay, it was possible is was an abugida, either a South Asian or South East Asian language, counting letters and vowel marker combinations as letters, but that surely wouldn’t take more than three hexadecimal digits.

In short, Cassie was completely stumped.

Then Cassie received another email. She checked it.

“Dany suspects I’ve already given the cipher to all of you. She’s in an extremely good mood for some reason. It’s great, but it’s also a little weird because I can’t make head or tail of the situation. You will have to crack it. My reputation depends on it. I’ll bring snacks and give you moral support.”

Typical Jake. But right now, she could do with snacks and moral support.



END OF CHAPTER TWO

Read previous chapters: chapter 1

Next chapter: chapter 3 | chapter 4

Thank you for reading! Do let me know if you manage to crack the cipher (hint: It doesn't require a key). The next chapter will be uploaded next Monday, 4th April.


You can also follow me on Facebook here.

Until next time!


Sunday, 20 March 2022

The Cipher - chapter 1 (short story)

chapter 2  | chapter 3 | chapter 4


Cassie, Anna, Jake, and Phil were in the university canteen having some fruit juice. The exams were over, and the four of them had spent the entire day shopping. Okay, it was window shopping mostly, but Cassie had really enjoyed herself.

Anna and Jake were third year electronics engineering students like Cassie. Phil was a computer science student, but he knew them from first year classes and the four had bonded instantly over common interests.

“So, let’s go our own way, then?” asked Anna.

Phil yawned. “Yup. Need nap. Brain not functioning anymore.”

“Um, actually, there’s something I wanted to talk to you about,” said Jake.

Cassie blinked. Was Jake actually being serious? What was going to happen next, the complete reversal of gravity?

“You’re good at ciphers, right, Cassie?”

“Maybe? I suspect Phil knows a bit about them too.”

“I’m average,” said Phil.

“Anyways, I need you two to decode something for me. You have nothing pressing at the moment, I assume?”

“Other than stuff I’m basically tinkering with, no,” said Phil.

“I’m not too busy either,” said Cassie.

“Okay, so my girlfriend has been sending some random texts. It definitely means something to her. I saw the messages and asked her about it, and she forwarded it to my phone at once. The thing is, the damn thing’s in a cipher of some sort. I can’t make head or tail of it.”

“A normal person would just ask their girlfriend, you know,” said Anna.

Cassie nodded.

“Apparently it’s a secret but I’m free to decode it if I can. So basically, it’s a challenge. The problem, as you are aware, is the fact that I have absolutely no idea how to crack a cipher. I mean, I could learn, but this doesn’t look like the kind of thing you can crack with a two day crash course.”

“So, what’s the cipher?” asked Cassie.

“I’ll forward it to you. I’ll give you moral support, but I’m letting you know in advance that I am terrible at…”

Phil yawned. “Just forward the damn thing.” 

“Okay.”

He forwarded a message to Cassie.

acbb87bc41b48b4dbc5f9b5716a7199a0959422a802f11b27a98a5d4ff06451afe6d26b68e5d7d2cac34ce32061b744893602e363a31d0a2018dc136ef39515da7826548327b

8fc83ebc51c12828a958aba9c26561a780e7e832a1988d64987d807a489fd2bbd123457e85e2f159685a4be44939c92ee970608b64b347fe17d1c1d3113b37a007edfb51368054c5c3c2da3be8eed0a2cbe

ca5c634da7451865d5a41c08d7968fb67b41652a3a44920f1c7e4f979f1dc23c8e0db94b6e89b00cf8a42d11b514d073e5570e65d240a70c87041f6752ce4e11b6b59f221e55b1a1651d

Cassie stared at it. It looked more like a list of numbers than actual ciphered text.

“It’s hexadecimal,” said Phil.

Jake shot him a blank look.

“You know, hexadecimal. Base 16? How did you submit you embedded programming assignment without it?”

“Y-yeah, I know, I just feel a little stupid. I should have realised that.”

“Is this an assignment or something then?” asked Cassie.

“Nah, we don’t have any assignments due right now,” said Phil, “Dany’s taking an elective that I’m not doing, but I don’t think they’d deal with strings of hexadecimal numbers.”

Cassie knew Dany – Jake’s girlfriend – as well, but they weren't really friends. She was generally a bit loud, but pleasant to be around. She was a computer science student like Phil.

“Are you sure this is a cipher?” asked Phil.

Jake shrugged. “Dany said so.”

“Anyway, we’ll work on this independently and share notes, say, tomorrow? Or just text?”

“Just email it if you get the solution,” said Phil, “I mean, you’re going to have to crack that thing on a computer and email's more convenient. I’m going to start work on it after my nap. See you later then!”

Phil left. Cassie, too, left for her dorm room. She tried staring at the numbers a few times as she walked. The obvious first solution was ASCII in hexadecimal. It would be super easy to convert, because of the sheer number of online converters.

Cassie took her phone out and looked at the numbers again. Then it clicked. It couldn’t be ASCII. This wasn’t Cassie’s strong suite, but she did remember that ASCII used 7 binary digits. Ergo, it could go from 00000000 to 01111111 in binary. That would be 0-127, or in hexadecimal, 0 to 7F. Therefore, if it was ASCII, every letter in the 0th, 2nd, 4th, etc position would have to be 7 or less. That was obviously not true, as the very first character in the cipher was A, or 10.

Of course, the person who made this cipher could be insane enough to just string the seven-bit numbers end to end. Would that leave a tell? She would have to check that once she returned to her dorm room.

She reached her room. She showered, had more snacks, and finally opened her laptop. She decided to have a go at the cipher for a bit. She started it up.

The computer took a bit of time to start. In the meantime, Cassie tried thinking through the problem again. Surely, the most important thing to figure out would be the identity of the creator of the cipher. Their personality would give them a clue about it.

Another thing to consider would be purpose. Could it be criminal? Unlikely. Dany wasn’t the criminal type as far as Cassie knew, and it would make no sense to hand over the cipher to Jake if it involved anything criminal. Jake didn’t have the patience to crack a cipher, but to assume it would be safe with him was foolish. He was friends with Phil, and Phil was really good with computers. He would surely crack it.

Another possibility was that this was enciphered with something like the regular encryption used for data transmission and stuff. Cassie didn’t know too much about it, but she knew for sure that that they involved long keys that would be near impossible to bruteforce. Guessing it would be out of the question.

In the first place, would Dany be able to pull off something like that? Cassie knew the answer immediately. Dany was smart and good at maths. If she understood the theory, she could program it manually even if she didn't have access to a dedicated program for the job.

If that was the case, there was no way they were cracking the code. Dany would have realised that. This could still be a criminal matter.

If not, the code would still be hard to crack, but it would be doable.

What would she do if the code was impossible to crack? Could she hand over the code to law enforcement? It wasn’t like Cassie knew a lot about how law enforcement really worked in the first place. But if it came down to that, could she do that? She would be betraying Jake’s trust. She would be betraying Dany’s confidence in Jake. But hiding a criminal matter could cause more harm in the long run. People were capable of becoming generally worse, especially with no feedback telling them that that was the case. Besides, Cassie, who had never broken a law in her life, would be aiding and abetting a criminal.

The computer finished booting up. Cassie let out a deep sigh. She didn’t know whether the code was breakable yet. She had to figure out that first. If it wasn’t, well, she could worry about it later.



END OF CHAPTER ONE


Thank you for reading! Do let me know if you manage to crack the cipher (hint: It doesn't require a key). 

Read next chapter: chapter 2  |  chapter 3 | chapter 4

You can also follow me on Facebook here.

Until next time!

 

Saturday, 19 March 2022

Hard vs soft magic systems - Advantages and disadvantages

 

I've used both hard and soft magic systems, and this article is a summary of my thoughts on the matter as a writer.

To start with, definitions:

A hard magic system is a magic system where the rules of magic are defined. The audience can learn knows what a character can do with their magic, essentially (or you know what they can do). If they can use, say, fire, they will always use fire. Or they may be able to use multiple types of magic, but maybe they know a few fixed spells which do something that is well-defined. They might able to do something under specific conditions (i.e., a type of magic that only works on full moon days).

A soft magic system is the opposite. The rules are less defined, there are no concrete laws that the magic system has to follow, and so on. This is the type of situation where there is little to no explanation on how the magic works.  

Of course, this is a spectrum. You could push a hard magic system to a level where you can calculate the exact power levels (though maybe this would get boring). Or you could have a soft magic system where your character just uses magic of the sort necessary when the situation calls for it with no explanation other than the character being a magic user. You could also have basically every point in between. The balance you want here really depends on the type of story you want to write.

Let's start with hard magic systems, the type I tend to write the most.

Hard magic systems

The biggest advantage to me, here, is that hard magic systems introduce a level of structure to the story. Usually, when you're going for a fantasy setting, you end up throwing some limiters of a real-world setting out of the window. A hard magic system can help remedy this and help maintain some tension in the story.

For example, assume your character is someone who can manipulate memories, but the rest of the story is based in the real world or something analogous to it. By giving your character such a power, you've removed some constraints on them. For example, they might be able to get out of a certain situation (say, if they were stopped for speeding in a vehicle) via memory manipulation. However, by limiting their powers to memory manipulation, you've also limited what they can do significantly. They can't necessarily get out of  physical altercation using it. It works even better if there are limits to what your character can do. Say they can manipulate one person every ten minutes. This would force them to rely on their wits to buy time, or just run away, or avoid using their powers during some confrontations. If the effect wears off within a set time, your character may have to get out of there fast before they're caught.

Basically, letting the audience know (or deduce) what your character can and can't do in advance lets them be more invested in the story because it makes the stakes real. There's tension in the story if your character can't just wave a wand and get out of the situation. There can be a different kind of tension if your reader is internally screaming at your character to do something (say, solving a problem with creative application of their powers, which can only work if said powers are defined already).

This is why some level of hard magic system works best when many or all of your cast can use magic (depending on genre, of course). If you don't define what your characters can and can't do in such a situation, your setting, logically, would be going into a complete meltdown. Another possibility is you could end up with a story with no stakes because it feels like the writer tosses a coin every time they need to figure out the results of a conflict.

Hard magic systems can also be used to force creative problem solving from your characters. This is certainly possibly with a soft magic system, but if the rules are already established and your character works around them, it becomes infinitely more satisfying. It is much easier to create that lightbulb moment when the reader has an understanding of the possibilities.

However, it is also necessary to talk about the disadvantages of a hard magic system. A hard magic system can kill a little bit of the magic and wonder of the setting based on implementation, pushing the feel of the setting from fantasy to somewhat similar to sci-fi (I'm not saying it makes the setting sci-fi, I'm saying it can give your setting a similar feel). That's not necessarily a bad thing though.

Another potential issue is, again, depending on the complexity of your setting, you might need copious amounts of notes. This isn't necessary to start with (I am an incurable pantster myself, but I make up a lot of details as I go and iron it out later in editing), but if you have a lot of characters or a complex setting, it might be necessary to make notes about the what certain characters can and can't do. You might think you can remember all the details (and sometimes you can), but with multiple iterations of characters, it might become confusing really quickly. Besides, readers will notice inconsistencies, especially if they affect the plot in any way. 

Soft magic systems

Let's talk about soft magic systems.

These can be a bit more nebulous, a bit more ill-defined. But there are definite advantages to that, as this same nebulous nature can give your story a more fantasy-like feel. 

This also means soft magic systems can be useful if there are few characters who can use magic, and they appear rarely / use magic rarely. In this kind of situation, it serves two purposes. It helps maintain an air of mystery about the character that uses magic. You can also use a soft magic system to limit your magic user when they appear. Maybe they can't do a particular thing when they appear because, say, the stars are wrong. Whether that works or not depends entirely on the type of story and how closely your POV character knows the magic user (though it is entirely possible to pull this off if your POV character is the magic user). 

You can also shift the stakes from what the magic user will do to whether they will appear / help. Maybe they like to test the other characters. Maybe they're unwilling to interfere unless absolutely necessary. If your magic user's utility is unpredictable, it can make the entire situation unpredictable and therefore interesting.

You can also use a soft magic system in a situation that doesn't fit what was discussed so far, if the stakes in the story are not necessarily related to magic. An example of this would be a situation where the story is more about the relationship between characters and less about battles between magic users. In that case, every single important character could have ill-defined magic powers, but your main focus would be the relationships between characters or their day-to-day hijinks.

When you talk about the disadvantages, well, the biggest disadvantage is that a badly used soft magic system can kill the stakes of a story instantly, as discussed above. Think about it, if you have the type of story where all your characters use magic, how ridiculous would it be if the effectiveness of each party depends entirely on what the writer wants, with no way to predict it in advance?

In conclusion

The important thing to remember is that this is very much a spectrum. Where you want to be depends on the story you want to tell and frankly, what kind of magic system you want to use. 

However, I personally don't really think about this process when designing a setting or coming up with a story idea. What happens happens. Sure, I might tweak it one way or the other depending on the feel of the story and the type of plot I'm going for, but that's about it. 

That might not be how it works for you, but you can figure it out fairly intuitively once you actually start writing. You just have to figure out what works for you.


I hope this helped you gain some understanding about this topic. Please do tell me your thoughts in the comments, and if you have anything to add, please do so.


You can also follow me on Facebook here.

Until next time!

Sunday, 13 March 2022

The Coloured Barcode - Chapter 3 (Short story)

The group study session was in one of the study areas. Half the class was there already, as well as a few fourth years. Cassie's classmates, the third years, were busy studying. That was to be expected, as a lot of them were a bit stuck on a lot of things that would be in the exam. The fourth years, by the looks of it, were goofing off. The conversation about the advantages and disadvantages of MCQs with negative marking.

"Oh hello Cassie! did you already do these two problems?" asked Anna.

Cassie blinked twice. She had not seen those two particular questions in her life. Anna understood this right away.

"Nevermind, do it now. Lex, you told us you'll teach us about this."

"Hand me the book," said Cassie. It would be good practice if nothing else.

Lex, one of the fourth-years, sighed. "I already taught you this. Look, if you're that overworked, work on your project or something. It's due with the exam, right?"

"No, two days afterwards, plus it's not the same subject," said Jake, one of Cassie’s classmates.

Cassie jumped. "But I already submitted it! The deadline is tomorrow and I didn't want..."

"We got an extension," said Jake.

“You traitor! Why didn’t you tell me?”

Jake shrugged. “It wouldn’t matter to you anyway. What were going to do, run it through a spell check for a fiftieth time?”

Cassie bit back a retort. She could have checked her calculations again and maybe polished the conclusion.

"Wait, about the project, how did you wire the seven-segment display? Four digits is impossible, right?" asked Anna.

"Forget the project - we'll tackle that when we have to," said Jake, "First, Cassie, can you solve this?"

Cassie gave him her best death glare - she was working on the two problems that Anna gave her earlier. She was kept quite busy for some time, solving question after question. As expected, her friends pointed out things that she had almost overlooked. She had no time to think of the cipher, let alone work on it. 

The rest of the class also joined them one by one. Anna was forced to shut up about the project for the time being. The fourth years helped as well - they had an exam the next day, but apparently, it was easy, so they had time to spare.

Finally, they decided to break for dinner. As they got up, Anna turned to Cassie.

"Really, Cassie, how did you wire the seven-segment display?"

"Huh? Did you switch the anode or the cathode?"

"What's the anode and what's the cathode? Which one is connected to which number? Look, explain it to me over dinner. Please? Don't tell me to look it up on the internet - I tried, I honestly tried..."

Cassie rolled her eyes. "Of course you did. Get me a paper and a pen."

Cassie sketched it on the paper. She explained it as quickly as she could. Then she returned to her bag to pack her things. That was when she noticed the slip of paper containing the cipher in her bag. She pulled it out again and looked at what she had decoded.

01236 10643 50263 46310 056432 12 2165 36201 52036 10346 246530 325062 5126 63012 12 21 60431 50236 21 02356 

It was definitely base 7. The seven-segment display was essentially seven digits, aka, base seven. This was too good to be a coincidence. She looked at the first entry - 01236. It was not repeated as is, but the same numbers, 0, 1, 2, 3, and 6, were present three times in the code. Not one entry had duplicate numbers. Her theory could be right. She took a piece of paper, and sketched the result, with the numbers 0-6 representing the segments a-g of a seven-segment display.

 Cassie sketched the first digit. It was the segment on top, then the one on the top right, then the bottom right, then the bottom segment, and finally, the middle segment. What emerged was, unmistakably, a 3.

That was better than nothing, but what was a number supposed to mean? She moved on to the next digit. Slowly, a set of numbers emerged.

A set of numbers, 3, 2, 5, 2, 6, 1, 4, 3, 5, 2, 6, 6, 4, 3, 1, 1, 2, 5, 1, 5

What Cassie noticed, instantly, was that the numbers were 1-6. Now there were six numbers instead of seven, she was back to where she started. She couldn't think of anything it could possibly mean. This set of numbers had to be the result – this cipher was incredibly inefficient in terms of the number of characters it took to represent a single digit. 

There were twenty digits – too much for a credit card number, even with the security code attached. If one number was a dummy, it was a possibility, but you’d have to know which number the dummy was. There were too many digits for it to be an account number. Perhaps it was an account number followed by a transaction code or amount.

But would any of them use just 0-6? That would be an insane coincidence.

It could also be a password. She didn't know the admin password in the department's computer labs, but this might be it. But then again, she thought, it was unsafe and ridiculously difficult to remember. It could also be the serial number of a SIM, but why would you even bother sending it to someone in such an obvious cipher? What could you use it for in the first place?

She could go dumpster diving again and find more papers written in the same code, but it was likely too late to do that now. She returned to the study room, still thinking about it.

As she settled down, Anna entered the room. She sat down next to Cassie and picked up a book. Cassie looked at her. She was rifling through the textbook with no real aim in mind. She decided to ask Anna.

"Anna, what kind of number has 20 digits?"

Anna looked at Cassie like she had grown another head. "Come again?"

"What king of number has twenty digits?"

"pi to twenty digits? I know only 3.14 though."

"Seriously, I meant a number that can actually mean something to someone. Our student ID is 8 digits, for example. What kind of number has 20 digits?"

"20 consecutive tosses of a die?" asked Anna.

It took a few seconds for that to sink in. That was it! It was the results from some gambling operation. It was probably run by some students. Then again, she deleted that thought immediately. No one would trust a gambling ring where the results were based on the result of a die if they didn't witness someone tossing the aforementioned die. If they were present, chances were, they'd write it down or take a video of it.

"Cassie, are you aright? I thought you were happy for a second, and then, immediately, you were like, oh, I'm out of battery, where is my charging port. Are your circuits actually fried?"

"Anna, I swear, if you call me a robot one more time, I will toss you out of that window over there."

"That's like, a metre off the ground."

"I'm not trying to murder you. I'm simply trying to be in a different room."

"What are you two arguing about?"

That was one of the fourth years, Bella.

"Cassie wants to know what a twenty-digit number could be," supplied Anna.

"A password created by a robot, a twenty-digit prime number used for encryption, like a key, but then 20 numerical digits is way too short," said Bella, "why?"

"Answers to an MCQ with 20 questions. Or would it be a, b, c, and d? Technically you could convert it to numbers." It sounded like a disembodied voice that sounded remarkably like one of their classmates, Jake. On closer inspection, it appeared to come from behind the bags.

"Yeah, then the numbers would have to be zero to four," said Cassie.

"Then show us the thing you're talking about," said Bella, "you obviously have a specific twenty-digit number in mind."

Anna was a simple airhead, Jake was a prankster, and Bella was a fairly normal nerd. None of them could be involved with the creation of a potentially criminal document. She showed them the paper.

"Hold on, I've seen these numbers before," said Bella, "I can't remember where, really, wait, what did you say, Jake, some time ago?"

"I have been silent for the past..." started Jake but was interrupted by Bella.

"MCQ! It's the answers for the freaking Econ MCQ! Where on earth did you find this, Cassie?"

"MCQ? Wait, what? It's not criminal? Are you sure?"

Anna chimed in. “Wait, you have six answers in an MCQ?”

Bella ignored her. "Where did you find it? Cassie, this could be serious. This could be serious academic misconduct. Where did you find it?"

"I - uh, I have a photo, give me a minute," said Cassie, quickly pulling it up on her phone. 

Was it just MCQ answers? No, that was not possible. She did not pour so much of her heart and soul into finding the answers to an MCQ. It was supposed to be something criminal. True, it was written on the back of a set of printed slides, which in hindsight, looked like econ notes. On the other hand, econ notes didn’t make something not criminal. There was hope yet.

"I knew it!" said Bella, "this is an econ note alright. Wait, where was this written?"

Cassie explained how she broke the code to her. Cassie's head was in a whirl. This could not be. As she was explaining this, Lex walked in. He listened in silence until the explanation finished.

"You actually broke the code? I thought that impossible. That's precisely why I threw it in the bin."

Bella turned and glared at him. Cassie’s heart sank. There was no way Lex would do anything criminal.

"Let me guess. You finished what you could of the paper, you were bored, you didn't want to submit the paper as it was, so you created a cipher just because you could to buy time to go over the paper with a fresh perspective before you handed it in," said Cassie.

"Great deduction," said Lex, "Well, done, detective Cassie."

Cassie blushed. Maybe it was worth it after all.

"Why, thank you!"

 


This is the final installment of this particular story. I hope you enjoyed it. Stay tuned for more of Cassie's adventures (hijinks?).

You can read Chapter 1 here and chapter 2 here.



This is the second edition of the story, the first is on Wattpad :)

You can also follow me on Facebook here.

Until next time!

Tuesday, 8 March 2022

Why daytime powercuts in Sri Lanka is nonsensical

 In short: we get more solar energy than we could possibly use. So why not make use of it?

Yes, there are problems with relying on solar. It's affected by weather. It's not available for half the day. The output is variable. But as a country, Sri Lanka is not affected by this as much as you'd think it is.

First of all  - the not available for half a day thing is consistent here. We don't have short winter days or extremely long summer days. Every day is roughly 12 hours of sunlight (except in super tropical thunderstorm season) and 12 hours of no sunlight. I'll get to the 12 hours of darkness issue later in the article.

The output variability can be an issue, but again, for most of the year, you have at least a few hours of unimpeded sunlight.

So, why aren't we using it?

Land looks like a major issue, but it really isn't. We have lots of open roof space, especially in suburban areas (standalone houses, mostly, whose energy consumption is much lower than what could be generated by solar panels). There's factories with lots of roof space. There is also an additional benefit to installing panels on roofs - temperature control. It would block a lot of heat that would get in through the roof otherwise.

In addition to that, there are streets. Sure, this is a bit more on the impractical side, but you could built slanting roofs over the sidewalk if you want to harness the energy off there as well. As an added bonus, your brain won't fry in the ten minutes it takes to walk to the bus stop.

Then there are train tracks and train stations. As a regular commuter, train stations clearly need more roof to cover the length of those platforms (so that we aren't drenched getting on/off a train in the rain), so why not use it as a side business and generate some electricity at the same time?

The tracks could be used too, as trains are usually a standard size, height-wise, which means you could install panels above the tracks in some clear areas where they don't impede signal visibility. Keeping the vines off them might be a problem though.

So basically, we don't necessarily need more land for this. Use those roofs. They're everywhere.

But the problem here is, even if you wanted to use the roof and install a solar unit for your house, it is pretty expensive and inconvenient. Panels and all that are expensive. Even if you prepared to bear the cost, the approval process for net metering is a pain and takes way too long. If they could reduce this to a couple of weeks at least, people might be more willing to make that investment. And if better loan schemes were available, that would help too.

The night time issue

As you are aware, we don't get any sunlight for approximately 12 hours a day. Can we generate enough power for those 12 h during the day? I don't have the figures, but it's likely. Whether we can store that power is another issue entirely.

Batteries would be way too expensive and polluting. However, we might be able to use our hydroelectric infrastructure to our advantage here and build a sort of water battery. Basically, pump the water upstream during the day, generate electricity as is flows down again at night. It will be lossy, but it's likely to be less expensive and polluting than batteries.

But regardless, it will be a project you would have to give a lot of thought to, so I'll leave this issue there. I might elaborate on this later.

In conclusion

Nighttime electricity generation or storage may be an issue, but for most days, you can generate a frankly ridiculous amount of electricity during the daylight hours using solar power. Therefore, there should be no reason we should be having electricity shortages during the day. 

I am aware that this is a very surface level article, but I needed to vent my frustration about this situation. That's it for now, I might come back and write a more detailed article on this later. 

You can follow me on Facebook here.

See you next time!

Monday, 7 March 2022

The Coloured Barcode - chapter 2 (Short Story)

 

There were eight distinct colours in the code. The number 8 had to have a meaning. The first thing that popped into Cassie’s mind was octal numbers – numbers which were base 8 instead of base 10 like normal denary numbers. She had learned these in school and university – well, they had focused more on binary and hexadecimal – but she had learned them. They fit right in, because each digit in octal numbers could only go from zero to seven, so only eight distinct symbols – colours in this case – were needed to represent any number.

Now that she had decided that it was octal, Cassie had a new problem. How was she to convert these randomly coloured lines to octal?

The first and most obvious step was to try statistical analysis. That was the standard approach to cracking any code as far as she knew. She looked at the  number of lines – 14 black, 13 brown, 16 red, 14 orange, 16 blue, 20 grey and 7 yellow and 9 green.

This did not look good. If the roman alphabet was used, the letters would go from A-Z, which would be 0-25 numerically. In octal, it would be 0-31. If this were true, she’d see much more of three colours – the colours that represented 0, 1 and 2 respectively. It wasn’t like it ruled it out, but it didn’t look good.

Cassie decided to test it regardless. Each letter would have to be represented by 2 digits to represent numbers 0-31, or there would have to be a break between characters. The latter seemed unlikely as that would result in about 40 lines in one colour, so Cassie decided to go with the former.

If that were true, the first digit would be the eights place. If the code really went from A-Z, the odd numbered lines could be only four colours - the colours corresponding to 0, 1, 2, and 3. That clearly wasn't the case. Cassie looked at every other line. It was black, red, blue, brown, blue – good so far – then, orange. Nope. That clearly wasn’t the case.

A set of coloured lines divided into three rows, containing 8 colours between them.


If it wasn't just, A-Z, she could try to include numbers, thought Cassie. That would raise the total number of characters to 35, which would be 43 in octal. Cassie looked at the lines after the orange one in the same way, and the very next was green. That was a no again.

Was it the full, alphanumeric character set? That would be 52 letters + 10 numbers, including both upper-case and lower-case letters, which would be 62 characters in total. That would be 76 in octal. If that were true, the second character would be limited to seven values. She counted it. Brown, orange, grey, black, yellow, grey, black, blue, grey, blue, brown, grey, green – that was eight colours, and that theory was down the drain as well.

Anyway, the two characters per letter thing didn’t make sense. The total number of characters was 109, a prime number. If the grey lines were considered dividers between words, that would make the character total 99. Now that was divisible by 3. 

But then, Cassie realized that this was completely impossible. First, If all colours were to have a uniform distribution, this would translate to something close to 777 in octal - or 512 characters. No one would use this many characters in day-to-day writing. Unless it was a language like Chinese, in which case she wasn’t likely to solve it anyway.

Also, if the grey lines were removed, the total number of colours would be down to 7, which would make octal extremely unlikely. Who on earth used base 7 numbers? It wouldn’t matter so much because this person clearly wasn’t trying to run it on a binary system like a computer, but converting it would be a pain.

She tried holding the paper far away, to see whether it looked like anything. Nope, it just looked like a bunch of lines. She tried turning it sideways, still nothing. Was it something wrong with the picture on her phone? She spent the next half an hour carefully sketching it, and then comparing it to the original several times. 

There was no flash of inspiration. Was there something that she missed? Was there something else on the paper she returned so dutifully to the bin? Cassie simple couldn't afford to spend too time on this. She had work to do - the next paper was only two days away anyway. She took her notes out and started studying.

Soon, the words blurred together in her mind. She started seeing the coloured strips in her head, mixed in with the circuit diagrams in her book. That didn't help her with either task.

Finally, she was about to go forage for a snack or something when her phone rang. It was Anna.

"Hey, Cassie, did you do question number 5 on chapter 6? Like seriously?"

"Let me check that - yeah, I think I did. Do you want me to send you the answer?"

"Sure but explain it to me. I don't understand your shorthand."

"Rude. That's not shorthand, that's perfectly acceptable notation you pleb."

"Whatever, just explain it to me. There are two loops..."

"Three, there's three," said Cassie, trying not to sigh, "you forgot the outer one. Look, this resister, the 5.6 k one..."

"Yeah, sure, that's like the proverbial 50 watermelons in maths questions in school," said Anna, "Does anyone even make 5.6 k resistors? What's even the colour code for that?"

"It's green, blue, red, right?" said Cassie, absently, "besides, a) it actually exists, which you would know if you read the textbook, b) they're not going to ask you about resistor codes or the existence of particular resistors, and c) it's an open book test so you can have the notes with you if you're paranoid. Resistor colour codes.... Anna, you're a genius!"

"I am? how?"

"Look, I'll send you the answer, figure it out for yourself."

"About how I'm a genius?"

"Nah, that's irrelevant. I'll explain it to you later - the question, I mean, once you've had a go at it. Bye, I'm busy."

With that, Cassie cut the call and returned to the code. Sure, all eight colours were part of the resistor code. The cipher was found outside the electronics department after all, so chances were, the resistor colour code was the key.

She was so close to cracking this code. What secrets would this discarded piece of paper hold? Would this be her debut as a genius amateur detective?

No, she told herself. Crack the code first, rejoice later. This was still only a possibility. Likelier than octal, but still, just a possibility.

The conversion was easy enough. In resistor code, each colour corresponds to a digit: black translates to 0, brown to 1, red to 2, orange to 3, yellow to 4, green to 5, blue to 6, violet to 7, grey to 8, and white to 9. She converted the code to the corresponding numbers and wrote it down.

The result was:

0123681064385026384631080564328128216583620185203681034682465308325062851268630128128218604318502368218023568

It was still 109 characters, but now it was numerical. It was definitely getting warmer. Unless she was getting carried away.

But no, she was onto something. There were seven numbers alright, but there wasn’t a single violet line. The numbers went from 0-6 and then skipped to 8. If it was resistor code, the code clearly wasn't octal.

The grey lines stood for 8, and there were 20 of them. What if her theory about them had been right about them being a divider? That could explain why a number was skipped and the frequency.

She wrote the numbers again, breaking them by number 8, which was the divider.

01236 10643 50263 46310 056432 12 2165 36201 52036 10346 246530 325062 5126 63012 12 21 60431 50236 21 02356 

The numbers were in groups of 2-6. There were 11 groups of 5, 3 groups of 6, 2 groups of four, and 4 groups of 2. This, again, was highly irregular. It didn’t look like the regular distribution of the lengths on words in English. The numbers all being 0-6 probably meant something as well. 

Cassie was at a loss. Could it be a language other than English?

A text from Anna shook her out of her reverie. It was a reminder to send the answer that she promised to send. Cassie found the question, photographed her answer, sent it, and returned to her studies. She didn't really have to study, but she didn't want to forget what she learned before she actually sat for the exam. 

The code could wait a couple of hours, she decided. She continued studying, mostly uninterrupted, until she received an invitation for a group study session at 6 pm. She decided to go. She was about to leave the code behind, but then, as an afterthought, she stuck it into her bag, before setting off for the library.

 


You can read Chapter 1 here.

The final chapter of this story (chapter 3) is available here.

This is the second edition of the story, the first is on Wattpad :)

You can also follow me on Facebook here.

Until next time!


How to write a character who is smarter than you

We all have that one character (or few) who is significantly smarter than the writer. So, as a writer, how do you write such a character con...