Hi all!!! Slack or similar apps message line length?

I just wandering why Slack don’t limit somehow lengths of message text displayed on the desktop as if we take it to full screen and don’t have any side windows opened, text in the messages is difficult to read?

Do they know that many users scale Slack window and they don’t want to hassle with that or they just say if you want you can because why not 🙂 ??

I’ve took Slack as an example of message app, but – Messenger has different approach – some limits and conversational layout.

What you think?

How to generate short fixed length cryptographic hashs?

I am trying to implement a kind of email verification system with a node.js server with no state.

The strategy

  1. User sends his email to the server
  2. Server generate a 4 digits code based on the email address and sends it to the user via email.
  3. User sends back the received code via email + the email address to the server
  4. Server re-generates the 4 digits code based on the email and compares it with the code sent by the user.

My implementation to generate the 4 digits code

  1. Create a HEX digest using HMAC SHA-256 hash function
  2. Take the first 3 characters of the digest
  3. Convert them to an integer
  4. If length < 4, concatenates one or multiples 0 at the end
const crypto = require('crypto')  const get4DigitsCode = (message) => {   const hash = crypto     .createHmac('sha256', Buffer.from(SECRET_KEY, 'hex'))     .update(message)     .digest('hex')    const first3HexCharacters = hash.slice(0, 3)    const int = parseInt(first3HexCharacters, 16)    let code = int.toString()   code =     Array(4 - code.length)       .fill(0)       .join("") + code    return code } 

After generating codes for 8293 email addresses, I noticed that I had 4758 duplicates. Is it normal to have this amount of duplicates for a code as this sort ? Is my strategy and my implementation secure (ability to guess the code) ?

ECDHE_RSA_WITH_AES_128_GCM_SHA256 – How to determine ECDHE Key Length?

Server: SSL Certificate, 2048-bit RSA Public Key, Signature Algorithm is sha256RSA

What am I missing here? !

  • I’ve scoured the RFC’s, and I have yet to find anything on how to determine the ECDHE key size (or any key exchange algorithm key size) in a TLS cipher suite. I need to confirm that ECDHE is at least 256 bits for compliance reasons.

  • In both RFC8422 and RFC4492 it’s emphasized that for ECDHE_RSA, the Certificate MUST contain an RSA public key… boom got it, now how do I determine the curve’s key length?

I don’t understand why in SSH, a key exchange algorithm like “ecdh-sha2-nistp384” has the curve size in it (which also determines the hash size), bit in a TLS cipher suite this is not the case.

  • The same thing goes for DHE_RSA_WITH_AES_128_GCM_SHA256 – How can I confirm that Diffie Hellman Ephermal is 2048 bits?

Is there other information I need to be looking at besides the Cert and the Cipher Suite? Do I need to dig into the code? Thanks in advance for any assistance with this!

Failing on queries with length of multiples of 32

tl;dr: Every SQL query of length 64 or higher that is a multiple of 32 results in the connection closing with a 2013 error when interacting with our remote MySQL server.

I am having the strangest issue with our MySQL database. For background, it is running MySQL v5.6 on a remote server hosted by Network Solutions which our IT requires us to use. As such, privileges are really lacking. I can create, read, update, and delete databases, tables, columns, rows, etc., but I can’t do things like restarting the server or defragging. I don’t believe our IT has access to do so either and this is just a Network Solutions thing.

When updating some values, I noticed that some queries were causing a MySQL 2013 error which is

Lost connection to MySQL server during query.

Those queries would continue to fail on retries, and past successes would still succeed. I realized that the common factor was that the failed queries all had a total length of 64, ex.

SELECT code FROM my_database WHERE assignee = 'abcde@gmail.com' 

Also noticed that it will continue to error out if the length is any other multiple of 32, except for 32 itself. The assignee in this instance can theoretically be any length up to 50, so the query can always theoretically be a multiple of 32 no matter how I format it.

I’ve tried with different tables, databases, and clusters and they all have the same issue. Also tried running the queries on a different computer. Strangely, phpMyAdmin does everything just fine.

The only solution I have right now is to check assignee length and change the query accordingly so that it isn’t going to fail but this is a lot of work to put in place for every single SQL statement I have written in our systems.

This might be an issue to bring up with Network Solutions but they have been extremely unhelpful in the past when it comes to technical issues and I don’t even know where to start on telling them how to fix it.

If the length of rope used in Rope Trick is the same as the height of the room, is the entrance at ceiling level?

In Rope Trick, you can use a length of rope up to 60 feet long to create “an extradimensional space that lasts until the spell ends”, but does the extradimension space have to fit in the material plane, or does it create an entrance to its space, similar to a portable hole? Specifically, would the entrance to the space be at the level of the ceiling, or would it stop a few feet under it?

Simple generator of pseudo-random permutations of variable length short sequence

The problem in front of me is to write a function (from scratch) to permute n elements, where n is an argument. I decided to break it down to applying Knuth’s shuffles algorithm, therefore I needed to write a pseudorandom number generator.

So now my task is to write a simple function F(seed,n) that will help me generate indices for the pseudorandom permutations of n elements. However, the function has to be extremely simple: My constraint is that I can only use the following operators: +,-,*,/,%, specifically, no address access, binary encoding, bits selection etc. – only arithmetic on numbers. That is fine, I went for linear congruental generators and implemented a (a*x+c)%m procedure.

As I started testing F(seed,2) it immediately went apparent that the results oscilate between zero and one with a period of two.

My problem is: how can I adjust F to avoid that behavior? Maybe I should generate the n-permutations in a different manner?

In practice, I am only interested in n=<32

Filename length restrictions for SharePoint Online?

I’m currently in the process of uploading (archiving) Remedy ticket attachments to SPO. When originally extracting attachments from the (Remedy) server, I ran into several instances where a file couldn’t be copied from one folder to another, due to filename length restrictions; I was using Server 2008 R2.

My question is, when uploading these files to SPO, will there be a chance of me getting warnings/errors due to filename lengths being too long? Should I go ahead and reformat all my file names to avoid this issue, or will I be okay without?

Calculate the length of the longest passage without traffic lights after each addition

There is a street of length x whose positions are numbered 0,1,…,x. Initially there are no traffic lights, but n sets of traffic lights are added to the street one after another.

Your task is to calculate the length of the longest passage without traffic lights after each addition.

Input: 8 3 3 6 2 Output: 5 3 3 

My approach: take l (low) and h (high) as 0 and x initially and update them accordingly if input lies between them, ans will be max(in-l,h-in). Found that this fails when in-l==h-in.

Taken from CSES. My code for reference: https://ideone.com/V6wAPf