/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

idris-lang.org/
en.wikipedia.org/wiki/Hash_function
en.wikipedia.org/wiki/Cryptographic_hash_function
en.wikipedia.org/wiki/Kübler-Ross_model
twitter.com/SFWRedditVideos

first for C++!

Don't use CMAKE you FOOL.

playing with C#, ASP.NET MVC and Entity Framework, also Unity now
lots of fun, microsoft got it right this time

third for Sup Forumsentooman goes to college

Second to C.

I am making a new encryption application, what hash function should I use for the encryption? :3

sounds like insecure teacher who hates being challenged and having his inadequacy exposed

This

You should support all of them and let the user decide, default to the most secure one.

What's wrong with CMake?

Thanks but what hash function exactly should be the default one?

introducing unnecessary complexity to very simple tasks.

It's a hell of a lot less complicated than autotools

the most secure one you dumb fuck.

And which one is that? You dumb fuck.

>because shit tool is shit, I justify this other shit tool

Call Scheineder and ask, dumb fuck.

What's better and has the same wide level of functionality, then? Oh, that's right, nothing.

He will shill his own though.

>cmake
>functionality

Either you trust him or you can only trust youself in which case you shoudn't be on Sup Forums but researching some serious math.

We are making a web browser!
Come and join the devs in the IRC.

G code. Random stuff

given up and writing everything in javascript

javascript maps and sets are useless

given up and writing eveything in C.

Javascript is garbage from top to bottom.

considering implementing a useful hashmap in javascript to replace the default map object

>What are you working on, Sup Forums?
Proving that AS3 is best language
Pic related: Proof

Not him but to be fair if I were that professor I'd be concerned too.
A classroom isn't a forum, it's a place of informational service. If you want to argue about semantics until you really understand something in your own way that might even be superior to the way your educator understood it, the kind of educator you need is a tutor, not a teacher. Teaching is just glorified, somewhat digestible info-dumping. That's what they pay us for, that's what we do, and if you try to get more than that out of us, you're cheating the rest of the class. You're here to learn, not to understand. You wanna understand? See me after class, or better yet go to fucking Google.

nothing implemented in javascript is useful

>public class
all i see is Java trash

this is the proof of the negation

>Using 4 conditionals for combinations of string/num instead of just converting conditionally and returning the add
You're only showing you write inefficiently

classes that arent interactive in the traditional sense are trash.
And teachers that cant handle autists shouldnt be teachers.

>he dosent consider how the flash bytecode works
Using several conditionals improved performance
Dont ask me how, it just did

Stop being disruptive in class or leave.

Probably because the way you wrote it the first time was bad too

Okay Rust-sama, gomen.

>classes that arent interactive in the traditional sense are trash.
I'm inclined to agree, but that's what you get when you go to a cheap ass school and share a class with a few hundred other people. Any good stuff is trash if you spread it thinly enough.

This
Also
>head of the department makes the opening speech
>1 gorillion mistakes
Keeping myself from exploding was painful.

>Keeping myself from exploding was painful.
See a doctor, that's not normal.

Probably.
But show me an example of quality actionscript code. I dare you. The language fights back, man, nothing makes sense.

Classes are a starting point. Want to know more? Hit the books.

Also, since you're easily triggered:
public class Vec3
{
public var x:Number = 0;
public var y:Number = 0;
public var z:Number = 0;
private var vec:Vector.;

public function setX(f:Number):void { x = f; vec = new Vector.; vec.push(x, y, z) ;}
public function setY(f:Number):void { y = f; vec = new Vector.; vec.push(x, y, z) ;}
public function setZ(f:Number):void { z = f; vec = new Vector.; vec.push(x, y, z) ;}

public function getVector():Vector.{return vec;}
public function overwriteValues(x:Number, y:Number, z:Number):void
{ vec = new Vec3(x, y, z).getVector(); }
public function Vec3(x:Number, y:Number, z:Number)
{ this.x = x; this.y = y; this.z = z; vec = new Vector.; vec.push(x, y, z); }

}

>caring about quality is unhealthy
No pajeet

>show me an example of quality actionscript code
I can't. I need to just drag down other people to feel better about myself. I'm sorry this is just how it has to be.

Can you really not do:
public var,y,z:Number = 0;

>caring
>getting so upset that you feel physical pain
They're not the same thing.

A lot of languages dont allow same-line assignments like that. Most allow shit like
public var y,z,:Number
but not assignment as well

Gotcha, like the rest of us then
You can, but the example was meant to be bad

Do you not understand the concept of an expression?

>but not assignment as well
then its a shit language.

if your language cannot handle infinitely long lists, it is a shit lang

No. I don't know what an expression is.

var list:List = new List();
while(1) list.append(0);

you mean lazily evaluated infinite sets?

An encryption of what ?
And what it has to do with hash function ?

Your language also cant come to a halt and hang when working with said list either :^)

>An encryption of what ?
Data

>And what it has to do with hash function ?
I will use the hash function to encrypt the data.

Any languages can given infinite memory.

idris-lang.org/

way ahead of you lad.
idris is love.

By definition, a hash function (!= encryption function) gives you a fingerprint of your data. md5 and sha1 are examples of hash functions.

So, you need an encryption algorithm. The next question is: symmetric, or not ?
Do you want to use the same key both at encryption and decryption ? (Adapted for storing personal files)
Or do you want to send data to other persons ?

>infinitely long lists
???
(define (infinitely-long-list-of-n+1 x) (+ x 1))

havent seen a single useful idirs program on here, ever

imagine using a language in which non-empty lists are not simply Cofree Maybe

Are you saying that you can't use a hash function to encrypt your data user? Because if so this is wrong as it makes no sense.

>The next question is: symmetric, or not ?
Symmetric

>Do you want to use the same key both at encryption and decryption ?
Yes

I made a mistake, it should be

case class List[A](head: A, tail: => List[A]) {
def ::(that: A): List[A] = List(that, this)
def ++(that: List[A]): List[A] = this
}

>Are you saying that you can't use a hash function to encrypt your data user?
That's exactly what I say.
A hash function gives you a hash. Its purpose is to have a checksum value with a fixed length.

> Symmetric

AES 256 is the industry standard today.

>That's exactly what I say.
This makes absolutely no sense though. Hash functions are used all the time for encryption.

>AES 256 is the industry standard today.
It's an old algorithm with all kinds of bad design decisions.

>Let me encryot my data by doing a one-way operation
>Now lets just get that back real qui... oh

>>Let me encryot my data by doing a one-way operation
It's not one-way though. If it was one-way it would not be called encryption.

>I made a mistake
Your life was a mistake

>Hurr durr im gonna encrypt my shit with hashes
>Dosent look up what hashes are
en.wikipedia.org/wiki/Hash_function

I know what hashes are though, no need to link the wiki.

Apparently not

Then you should know they are specifically one way
Any function that is not one way is by definition not a hash function

Nice trolling, asshole.

>hashes are used for encryption all the freaking time
>haha, they are not lol --you

Hashes are one way, encryption with them isn't however.

>Hashes are one way, encryption with them doesn't happen however.
ftfy

>Hashes are one way, encryption with them isn't however

Your logic just evaporated.
Function A has property B, therefore doing action C with function A must adhere to property B

Encryption with cryptographic hashes happens all the time, why are you lying?

Then, how do you encrypt data with hash encryption ?
Try encrypting a file with sha256, and gives us the result

>A hash function is any function that can be used to map data of arbitrary size to data of fixed size

>Hashes are one way, encryption with them isn't however.

You're a moron.

>cryptographic hashes
Do not exist

>Encryption with cryptographic hashes happens all the time, why are you lying?
kek

en.wikipedia.org/wiki/Cryptographic_hash_function

y'all need to learn what an HMAC is

That still adheres to general hash principles you fucking moron

>Function A has property B, therefore doing action C with function A must adhere to property B
This is wrong in the real world.

>>A hash function is any function that can be used to map data of arbitrary size to data of fixed size
And we use that property to encrypt with them.

Sure, assuming ascii and the key "key" it will be 0xe2

How am I wrong?

What is sha1 then?

Hashes can still be used for encryption.

cryptographic hashes != encryption
They are used to prove a specific data is correct (not corrupted nor modified by an attacker). What makes them "cryptographic" is the fact that they can't be falsified.

Oy vey

en.wikipedia.org/wiki/Kübler-Ross_model

>Sure, assuming ascii and the key "key" it will be 0xe2
*to encrypt "a"

What is the purpose of the hash function in your program? In general, SHA-256 is more than enough, but if you are paranoid, use SHA-512. For key derivation, use scrypt.

Cryptographic hashes can still be used for encryption.

Yes? What are you trying to prove?

>What is the purpose of the hash function in your program?
To encrypt the data.

>Yes? What are you trying to prove?
Are you blind?
You litteraly linked a page calling even cryptographic hashes for one-way functions
Are you actually mentally challenged?

>And we use that property to encrypt with them.
You can't encrypt with a function that maps to data of fixed size. An encryption function must be injective.

disagree
pic related