[Newbie friendly] Point Prizes : new methods | Proxies-free

  1. Alpha1404
    Member


    Joined:
    Jun 25, 2021
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6

    We all knew the Point Prizes method that allowed us to earn points and therefore money, with coupon codes that we found on the Web.
    But, you also know that this method does not work anymore, since they changed the interface.
    Except that: the new interface presents two new flaws, which allow earning money more easily.

    Hidden Content:

    You must reply before you can see the hidden data contained here.

    Enjoy.

     

google chrome – My introduction and a newbie question about Ubuntu

There other day, I finally decided to try out Linux and Ubuntu, after several hours researching and contemplating about the right distro for me.

After over one day of use doing most of the things I do on Windows 10, on the same laptop, I noticed that some programs are slower(?), take time to load, and sometimes crashes(?). I’m not quite certain except that it happens rarely when I was on Windows 10.

I’m on a budget setup that I’ve used for work for years and thought that switching to Linux would breathe life to my old PC. I was wondering if anyone could give me an idea what I’m doing wrong.

Some things you might be interested to know to be of help: the programs I use that seem slower are the Chrome browser and Spotify. Upgraded 12GB RAM, have 1 extended display, and everthing I use now, I’ve used last year but on Win10. Any input would be greatly appreciated. I also hope to be a productive member of this community.

JB

tls – SSL newbie – in which scenario a client needs a certificate?

I am new to SSL/TLS, and need some help with understanding.

I am running a java application, which is able to consume HTTP and HTTPS URLs as a client from the internet via httpClient. For that, I don’t need to add any certificate or keys and do not have to generate anything.

Now imagine the client would need a certificate and I am getting a SSLException. What does the server have to change so that I would get a SSLException when I try to connect? Is there a kind of a setting? And is this “two-way-ssl” then or is this called “ssl client certificate authentication”?

Is there a common website, against which I could test this scenario?

Once I copied a certificate from the browser into a file and installed it on my workstation, then I was able to use Firefox to enter a specific website. Was this one a self-signed certificate then, which is somehow private?

beginner – Enigma Implementation by JAVA newbie

I want to learn Java, so I ported a C# Enigma implementation of mine. It got UnitTests and is running.

I’m looking for a review, telling me, where I don’t know best practices, where I break naming conventions, where I look like a C# programmer writing Java:-)

Thanks & have fun Harry

https://github.com/HaraldLeitner/Enigma

BusniessLogic.java

package main;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class BusinessLogic {
    private List<Roll> Rolls;
    private List<Roll> RollsReverse;

    public BusinessLogic(List<Roll> rolls) {

        Rolls = rolls;

        RollsReverse = new ArrayList<Roll>(rolls);
        Collections.reverse(RollsReverse);
    }

    public void TransformFile(String inputFfilename, String outputFilename, Enums.Mode mode) throws IOException {
        final int buffersize = 65536;

        FileInputStream fileInStream = new FileInputStream(inputFfilename);
        FileOutputStream fileOutStream = new FileOutputStream(outputFilename);

        byte() buffer = new byte(buffersize);
        int readCount = 0;

        while ((readCount = fileInStream.read(buffer, 0, buffersize)) > 0) {
            TransformByteArray(buffer, mode);
            fileOutStream.write(buffer, 0, readCount);
        }

        fileInStream.close();
        fileOutStream.close();
    }

    public void TransformByteArray(byte() input, Enums.Mode mode) {

        if (mode == Enums.Mode.Encode) {

            for (int i = 0; i < input.length; i++) {
                for (Roll roll : Rolls)
                    input(i) = roll.Encrypt(input(i));

                RollOn();
            }
        }

        if (mode == Enums.Mode.Decode) {
            for (int i = 0; i < input.length; i++) {
                for (Roll roll : RollsReverse)
                    input(i) = roll.Decrypt(input(i));

                RollOn();
            }
        }
    }

    private void RollOn() {
        for (Roll roll : Rolls) {
            if (!roll.RollOn())
                break;
        }
    }
}

Enigma.Properties

TransitionCount = 53

Enums.java

package main;

public class Enums 
{
    public enum Mode 
    {
        Encode, 
        Decode
    };

}

Program.java

package main;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Random;

public class Program {
    private static List<Roll> Rolls;
    private static Enums.Mode Mode;
    private static String KeyFilename;
    private static String InputFileName;
    private static int TransitionCount;

    public static void main(String() args) throws Exception {
        if (args.length != 3) {
            System.out.println("Generate key with 'keygen x key.file' where x > 3 is the number of rolls.");
            System.out.println("Encrypt a file with 'enc a.txt key.file'");
            System.out.println("Decrypt a file with 'dec a.txt key.file'");

            return;
        }

        ReadProperties();

        KeyFilename = args(2);

        if (args(0).compareToIgnoreCase("keygen") == 0) {
            Keygen(Integer.parseInt(args(1)));
            return;
        }

        InputFileName = args(1);
        CreateRolls();

        if (args(0).compareToIgnoreCase("enc") == 0)
            Mode = Enums.Mode.Encode;
        else if (args(0).compareToIgnoreCase("dec") == 0)
            Mode = Enums.Mode.Decode;
        else
            throw new Exception("Undefined Encryption Mode.");

        BusinessLogic businessLogic = new BusinessLogic(Rolls);

        businessLogic.TransformFile(InputFileName, InputFileName + "." + Mode, Mode);
    }

    private static void ReadProperties() throws FileNotFoundException, IOException {
        Properties prop = new Properties();
        
        prop.load(new FileInputStream("Enigma.properties"));

        TransitionCount = Integer.parseInt(prop.getProperty("TransitionCount"));
    }

    private static void CreateRolls() throws Exception {
        Rolls = new ArrayList<Roll>();

        int rollKeylength = 256 + TransitionCount;

        byte() definition = new byte((int) new File(KeyFilename).length());
        FileInputStream fileInputStream = new FileInputStream(KeyFilename);
        fileInputStream.read(definition);
        fileInputStream.close();

        if (definition.length % rollKeylength > 0)
            throw new Exception("Invalid Keysize");

        int rollCount = definition.length / rollKeylength;

        for (int rollNumber = 0; rollNumber < rollCount; rollNumber++) {
            List<Integer> transitions = new ArrayList<Integer>();

            for (int index = 0; index < TransitionCount; index++)
                transitions.add((int) definition(rollNumber * rollKeylength + 256 + index)); 

            byte() singleRoll = new byte(256);
            for(int index = 0; index < 256; index ++)
                singleRoll(index) = definition(rollNumber * rollKeylength + index);

            Rolls.add(new Roll(singleRoll, transitions));
        }

        for (Roll roll : Rolls)
            roll.CheckInput(TransitionCount);
    }

    private static void Keygen(int rollCount) throws Exception {
        
        if (rollCount < 4)
            throw new Exception("Not enough rolls.");

        Random random = new Random();

        if((new File(KeyFilename)).exists())
            Files.delete(Paths.get(KeyFilename));

        byte() key = new byte((256 + TransitionCount) * rollCount) ;

        for (int i = 0; i < rollCount; i++) {
            byte() transform = new byte(256);
            for (int j = 0; j <= 255; j++)
                transform(j) = (byte) j;

            while (!IsTwisted(transform)) {
                for (int j = 0; j < 256 * 2; j++) {
                    int rand1 = random.nextInt(256);
                    int rand2 = random.nextInt(256);

                    byte temp = transform(rand1);
                    transform(rand1) = transform(rand2);
                    transform(rand2) = temp;
                }
            }

            for (int index = 0; index < 256; index++)
                key((256 + TransitionCount) * i + index) = transform(index);

            List<Integer> transitions = new ArrayList<Integer>();

            while (transitions.size() < TransitionCount) 
            {
                int rand = random.nextInt(256);
                if (!transitions.contains(rand))
                    transitions.add(rand);
            }

            for (int index = 0; index < TransitionCount; index++)
                key((256 + TransitionCount) * i + 256 + index) = (byte)(int) transitions.get(index);            
        }

        FileOutputStream fileOutputStream = new FileOutputStream(KeyFilename);
        fileOutputStream.write(key);
        fileOutputStream.close();

        System.out.println("Keys generated.");
        Thread.sleep(1000);
    }

    private static boolean IsTwisted(byte() trans) {
        for (int i = 0; i <= 255; i++)
            if (trans(i) == i)
                return false;

        return true;
    }
}

Roll.java

package main;

import java.util.Collections;
import java.util.List;


public class Roll
 {
    private int Position;          //This is the actual position of this roll starting at 0
    private byte() Transitions;     //This is the wiring of the roll: if Transitions(0) = 0x04 the value 0x00 will be mapped to 0x04
    private List<Integer> TurnOverIndices;  //While rolling after each char encryption the next roll will also rotate, if these indices contain Position 
    private byte() ReTransitions;   //Reverted transitionlist for decryption

    public Roll(byte() transitions, List<Integer> turnOverIndices) {
        Transitions = transitions;
        TurnOverIndices = turnOverIndices;
        Position = 0;

        ReTransitions = new byte(256);
        for (int i = -128; i < 128; i++)
            ReTransitions(Transitions(i + 128) + 128) = (byte) i;
    }

    public void CheckInput(int transitionCount) throws Exception {
        if (Transitions.length != 256)
            throw new Exception("Wrong Transition length ");

        for (int i = -128; i < 128; i++) {
            boolean found = false;
            for (int j = 0; j < 256; j++)
            {
                if (Transitions(j) == i)
                {
                    found = true;   
                    break;
                }
            }
            if (!found)
                throw new Exception("Transitions not 1-1 complete. Problem at " + i);
        }

        if (TurnOverIndices.size() != transitionCount)
            throw new Exception("Wrong TurnOverIndices length ");

        Collections.sort(TurnOverIndices);

        for (int i = 0; i < TurnOverIndices.size() - 1; i++)
            if (TurnOverIndices.get(i) == TurnOverIndices.get(i + 1))
                throw new Exception("Turnoverindizes has doubles");
    }

    public byte Encrypt(byte input) {
        return Transitions(((input + Position + 128)%256));
    }

    public byte Decrypt(byte input) {
        return (byte) (ReTransitions(input + 128) - Position);
    }

    public boolean RollOn() {
        Position = (Position + 1) % 256;
        return TurnOverIndices.contains(Position);
    }
}

UnitTest.java

package test;

import static org.junit.jupiter.api.Assertions.*;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.imageio.stream.FileImageInputStream;
import javax.xml.stream.events.EntityDeclaration;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import main.*;

class UnitTest {

    byte() transLinear = new byte(256); // here every char is mapped to itself
    byte() transLinearInvert = new byte(256); // match the first to the last etc
    byte() transShift1 = new byte(256); // 'a' is mapped to 'b' etc
    byte() transShift2 = new byte(256); // 'a' is mapped to 'c' etc

    private BusinessLogic BusinessLogicEncode;
    private BusinessLogic BusinessLogicDecode;

    byte() encryptedMsg;
    byte() decryptedMsg;

    void Crypt(byte() msg) {
        encryptedMsg = msg.clone();
        BusinessLogicEncode.TransformByteArray(encryptedMsg, Enums.Mode.Enc);
        decryptedMsg = encryptedMsg.clone();
        BusinessLogicDecode.TransformByteArray(decryptedMsg, Enums.Mode.Dec);
    }

    @BeforeEach
    public void Init() {
        for (int i = -0; i < 256; i++)
            transLinear(i) = (byte) (i - 128);

        for (int i = 0; i < 256; i++)
            transLinearInvert(i) = (byte) (255 - i - 128);

        for (int i = 0; i < 256; i++)
            transShift1(i) = (byte) ((i + 1 - 128) % 256);

        for (int i = 0; i < 256; i++)
            transShift2(i) = (byte) ((i + 2 - 128) % 256);
    }

    void InitBusinessLogic(ArrayList<byte()> transitions, ArrayList<ArrayList<Integer>> turnovers) {
        if (transitions.size() != turnovers.size())
            assertFalse(true, "There must be as much transitions as roll defs!");

        List<Roll> rollsEncrypt = new ArrayList<Roll>();
        List<Roll> rollsDecrypt = new ArrayList<Roll>();

        for (int i = 0; i < transitions.size(); i++) {
            rollsEncrypt.add(new Roll(transitions.get(i), turnovers.get(i)));
            rollsDecrypt.add(new Roll(transitions.get(i), turnovers.get(i)));

        }

        BusinessLogicEncode = new BusinessLogic(rollsEncrypt);
        BusinessLogicDecode = new BusinessLogic(rollsDecrypt); // need a second, because the enc BusinessLogic has
                                                                // turned over rolls
    }

    @Test
    public void OneByte1RollLinear() {
        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transLinear);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i });

            assertEquals(i, encryptedMsg(0));
            assertEquals(i, decryptedMsg(0));
        }
    }

    @Test
    public void OneByte1RollShift1() {
        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transShift1);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i });
            assertEquals((byte) (i + 1), encryptedMsg(0));
            assertEquals(i, decryptedMsg(0));
        }
    }

    @Test
    public void OneByte1RollShift2() {
        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transShift2);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i });
            assertEquals((byte) (i + 2), encryptedMsg(0));
            assertEquals(i, decryptedMsg(0));
        }
    }

    @Test
    public void TwoByte1RollLinear() {
        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transLinear);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i, (byte) ((i + 1)) });

            assertEquals(i, encryptedMsg(0));
            assertEquals((byte) (i + 2), encryptedMsg(1));

            assertEquals(i, decryptedMsg(0));
            assertEquals((byte) (i + 1), decryptedMsg(1));
        }
    }

    @Test
    public void TwoByte1RollShift() {
        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transShift1);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i, (byte) ((i + 1)) });

            assertEquals((byte) (i + 1), encryptedMsg(0));
            assertEquals((byte) (i + 3), encryptedMsg(1));

            assertEquals(i, decryptedMsg(0));
            assertEquals((byte) (i + 1), decryptedMsg(1));
        }
    }

    @Test
    public void TwoByte1RollInvert() {
        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transLinearInvert);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i, (byte) ((i)) });

            assertEquals((byte) (-i - 1), encryptedMsg(0));
            assertEquals((byte) (-i - 2), encryptedMsg(1));

            assertEquals(i, decryptedMsg(0));
            assertEquals(i, decryptedMsg(1));
        }
    }

    @Test
    public void TwoByte2RollLinearInvert() {

        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transLinearInvert);
            transformation.add(transLinearInvert);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i, (byte) ((i + 1)) });
            assertEquals(i, encryptedMsg(0));
            assertEquals((byte) (i + 2), encryptedMsg(1));

            assertEquals(i, decryptedMsg(0));
            assertEquals((byte) (i + 1), decryptedMsg(1));
        }
    }

    @Test
    public void TwoByte2RollShift() {
        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transShift1);
            transformation.add(transShift1);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i, (byte) ((i + 1)) });
            assertEquals((byte) (i + 2), encryptedMsg(0));
            assertEquals((byte) (i + 4), encryptedMsg(1));

            assertEquals(i, decryptedMsg(0));
            assertEquals((byte) (i + 1), decryptedMsg(1));
        }
    }

    @Test
    public void TwoByte2RollShift2() {
        ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
        ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>(0);
        turnovers.add(turnover);
        turnovers.add(turnover);

        ArrayList<byte()> transformation = new ArrayList<byte()>();
        transformation.add(transShift2);
        transformation.add(transShift2);

        InitBusinessLogic(transformation, turnovers);

        Crypt(new byte() { 7, 107 });

        assertEquals(11, encryptedMsg(0));
        assertEquals(112, encryptedMsg(1));

        assertEquals(7, decryptedMsg(0));
        assertEquals(107, decryptedMsg(1));
    }

    @Test
    public void TwoByte2RollInvert() {
        for (int i = -128; i < 128; i++) {
            ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0));
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(turnover);
            turnovers.add(turnover);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transLinearInvert);
            transformation.add(transLinearInvert);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i, (byte) ((i + 1)) });
            assertEquals((byte) (i), encryptedMsg(0));
            assertEquals((byte) (i + 2), encryptedMsg(1));

            assertEquals(i, decryptedMsg(0));
            assertEquals((byte) (i + 1), decryptedMsg(1));
        }
    }

    @Test
    public void ThreeByte2RollTransit() {
        ArrayList<Integer> always = new ArrayList<>();
        for (int j = 0; j < 256; j++)
            always.add(j);

        for (int i = -128; i < 128; i++) {
            ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
            turnovers.add(always);
            turnovers.add(always);

            ArrayList<byte()> transformation = new ArrayList<byte()>();
            transformation.add(transLinear);
            transformation.add(transLinear);

            InitBusinessLogic(transformation, turnovers);

            Crypt(new byte() { (byte) i, (byte) (i + 1), (byte) (i + 2) });

            assertEquals((byte) (i), encryptedMsg(0));
            assertEquals((byte) (i + 3), encryptedMsg(1));
            assertEquals((byte) (i + 6), encryptedMsg(2));

            assertEquals(i, decryptedMsg(0));
            assertEquals((byte) (i + 1), decryptedMsg(1));
            assertEquals((byte) (i + 2), decryptedMsg(2));
        }
    }

    @Test
    public void TwoByte2DifferentRollsTransit() {
        ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4));
        ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
        turnovers.add(turnover);
        turnovers.add(turnover);

        ArrayList<byte()> transformation = new ArrayList<byte()>();
        transformation.add(transLinear);
        transformation.add(transShift1);

        InitBusinessLogic(transformation, turnovers);

        Crypt(new byte() { 7, 107 });

        assertEquals(8, encryptedMsg(0));
        assertEquals(110, encryptedMsg(1));

        assertEquals(7, decryptedMsg(0));
        assertEquals(107, decryptedMsg(1));
    }

    @Test
    public void TwoByte2DifferentRollsTransit3() {
        ArrayList<Integer> turnover = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4));
        ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
        turnovers.add(turnover);
        turnovers.add(turnover);

        ArrayList<byte()> transformation = new ArrayList<byte()>();
        transformation.add(transLinear);
        transformation.add(transLinearInvert);

        InitBusinessLogic(transformation, turnovers);

        Crypt(new byte() { 7, 107 });

        assertEquals(-8, encryptedMsg(0));
        assertEquals(-110, encryptedMsg(1));

        assertEquals(7, decryptedMsg(0));
        assertEquals(107, decryptedMsg(1));
    }

    @Test
    public void RealLive()
    {
        int msgSize = 5 * 65536;

        byte() msg = new byte(msgSize);
        for (int i = 0; i < msgSize; i++)
            msg(i) = (byte)(i);

        ArrayList<Integer> turnover1 = new ArrayList<>(Arrays.asList(0, 22, 44, 100));
        ArrayList<Integer> turnover2 = new ArrayList<>(Arrays.asList(11, 44, 122, 200));
        ArrayList<Integer> turnover3 = new ArrayList<>(Arrays.asList(33, 77, 99, 222));
        ArrayList<Integer> turnover4 = new ArrayList<>(Arrays.asList(55, 67, 79, 240));
        ArrayList<ArrayList<Integer>> turnovers = new ArrayList<ArrayList<Integer>>();
        turnovers.add(turnover1);
        turnovers.add(turnover2);
        turnovers.add(turnover3);
        turnovers.add(turnover4);

        ArrayList<byte()> transformation = new ArrayList<byte()>();
        transformation.add(transLinear);
        transformation.add(transLinearInvert);
        transformation.add(transShift1);
        transformation.add(transShift2);

        InitBusinessLogic(transformation, turnovers);

        Crypt(msg);

        assertEquals(msg.length, decryptedMsg.length);
        
        Crypt(msg);

        for (int i = 0; i < msgSize; i++)
            assertEquals(msg(i), decryptedMsg(i));
    }

    @Test
    public void Integrationtest() throws Exception
    {
        int msgSize = 5 * 65536;    //bigger than buffersize:-)
        String keyname = "any.key";
        String msgFileName = "msg.file";

        byte() msg = new byte(msgSize);
        for (int i = 0; i < msgSize; i++)
            msg(i) = (byte)(i % 256);

        FileOutputStream fileOutputStream = new FileOutputStream(msgFileName);
        fileOutputStream.write(msg);
        fileOutputStream.close();

        Program.main(new String() { "keygen", "4", keyname});
        Program.main(new String() { "enc", msgFileName, keyname });
        Program.main(new String() { "dec", msgFileName + ".Enc", keyname });
 
        byte() encdec = new byte(msgSize);
        FileInputStream fileInputStream = new FileInputStream(msgFileName + ".Enc.Dec");
        fileInputStream.read(encdec);
        fileInputStream.close();

        for(int i = 0; i < msg.length; i++)
            assertEquals(msg(i), encdec(i));

        assertEquals(msg.length, encdec.length);
    }
}
```

Enigma Implementation in 3 languages: C# pro, JAVA and Python newbie

I want to learn Java and Python, so I ported a C# Enigma implementation of mine.
All of them have UnitTests and are running.

I’m looking for a review,
telling me, where I don’t know best practices,
where I break naming conventions, where I look like a C# programmer writing Java and Python:-]

Thanks & have fun
Harry

https://github.com/HaraldLeitner/Enigma

Ubuntu 21.04. Newbie here. Please confirm correctness before I do a Timeshift system restore

Newbie here. See pics. Some of my apps got messed up and I want to do a Timeshift system restore to yesterday (Aug 10th). Please look at the pics and see if I’m all set to do a restore. Will this restore take my apps back to yesterday? I want to make sure cuz I know a bad restore can trash my whole system. Thanks.enter image description here

Kafka Newbie Question – Database Administrators Stack Exchange

Pls don’t give a negative vote to this, just coz this is a n00b question. I am trying to learn this new tech, and it looks promising.

My data source, producer, consumer are all on the same server (lab setup). And:

  1. I created a Kaka topic:
    bin/kafka-topics.sh --create --topic T1 --bootstrap-server localhost:9092

  2. I loaded many csv into the topic:
    bin/kafka-console-producer.sh --topic T1 --bootstrap-server localhost:9092 < FILENAME

  3. The csv are in many GB in size, and are in the format one row for one record. Format:
    Email,event_ID,timestamp,Description. All CSV files will always have a header-row

  4. I can see all data successfully , using:
    bin/kafka-console-consumer.sh --topic T1 --from-beginning --bootstrap-server localhost:9092

Question1 How can I search and return rows only where email address equals email@foo.com.

Question2 How can I search and return rows where email address equals “email@foo.com” AND event_ID equals “Z9284M”

I am aware I can grep the relevant rows. But that will be too slow & resource intensive. Is there a way for Kafka to index the data and search efficiently?

Would appreciate all help!