Re: Question on Password Encryption, using stdlib or third party lib

2019-07-29 Thread 0xFFFFFFFF via Digitalmars-d-learn

On Monday, 29 July 2019 at 14:37:54 UTC, 0x wrote:

On a project I was asked to

a- Compute SHA-256 of a password
b- Do a BigInteger, convert to Hex String
c- Encrypt the key using a public key with the following 
parameters

  Entropy: I'm given some numbers
  Modulus: also given long numbers

[encrypt using RSA algorithm]

So far I'm familiar with a and b in Dlang.

how do I go about c) In Dlang ?

Thanks


It is exponent not entropy


Question on Password Encryption, using stdlib or third party lib

2019-07-29 Thread 0xFFFFFFFF via Digitalmars-d-learn

On a project I was asked to

a- Compute SHA-256 of a password
b- Do a BigInteger, convert to Hex String
c- Encrypt the key using a public key with the following 
parameters

  Entropy: I'm given some numbers
  Modulus: also given long numbers

[encrypt using RSA algorithm]

So far I'm familiar with a and b in Dlang.

how do I go about c) In Dlang ?

Thanks


Re: Disable dub from checking internet before building

2019-02-27 Thread 0xFFFFFFFF via Digitalmars-d-learn

On Monday, 25 February 2019 at 18:54:03 UTC, Jacob Carlborg wrote:

On 2019-02-24 23:51, 0x wrote:
How to disable dub from checking internet before building, 
it's slowing down build whenever it does this.


I thought that was fixed [1]. Or is it doing something else?

[1] https://dlang.org/changelog/2.082.0.html#upgrade_check


Time to upgrade then.


Re: Disable dub from checking internet before building

2019-02-25 Thread 0xFFFFFFFF via Digitalmars-d-learn

On Monday, 25 February 2019 at 06:29:14 UTC, drug wrote:

On 25.02.2019 1:51, 0x wrote:
How to disable dub from checking internet before building, 
it's slowing down build whenever it does this.
`--skip-registry=all` let you avoid checking of all 
dependencies (https://dub.pm/commandline)


Thanks all, I believe --skip-registry=all resolves and checking 
the docs again it seems to be what I'm looking for. What a narrow 
miss!


Thanks again.


Disable dub from checking internet before building

2019-02-24 Thread 0xFFFFFFFF via Digitalmars-d-learn
How to disable dub from checking internet before building, it's 
slowing down build whenever it does this.


Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn

On Wednesday, 21 February 2018 at 10:24:39 UTC, ketmar wrote:

0x wrote:


[...]


and that is exactly what slices are for! ;-)

you are probably better to use `const(char)[]`, tho. like this:

	// don't store `s`, as it's contents may change after exiting 
of `myfunc`

// (this is what `const` implies here)
void myfunc (const(char)[] s) { ... }

...
string s = "test string";
myfunc(s); // yep, this works
s = s[2..4]; // this doesn't allocate
myfunc(s);
myfunc(s[3..6]); // or this, it doesn't allocate
myfunc("abc"); // or this, doesn't allocate

you got the idea.


Gotta save this too.

[BTW how do I post a thumbs up emoji]


Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn

On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote:
What is the equivalent of C++17 std::string_view (an object 
that can refer to a constant contiguous sequence of char-like 
objects with the first element of the sequence at position 
zero) in D?


PS: I'm getting back to D after years (since DMD 1 days). A lot 
changes since v1.0.


Thanks guys @all. I completed the task.

Glad to know there are lots people helping out here.


Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:22:56 UTC, rikki cattermole 
wrote:

On 21/02/2018 10:17 AM, 0x wrote:
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x 
wrote:
What is the equivalent of C++17 std::string_view (an object 
that can refer to a constant contiguous sequence of char-like 
objects with the first element of the sequence at position 
zero) in D?


PS: I'm getting back to D after years (since DMD 1 days). A 
lot changes since v1.0.


Wow! Thanks guys.
Those are handy, but I specifically want to do something like:

```
string_view sv = "some string";
```


string sv = "some string";
assert(sv.length == 11);

Or just "some string".length ;)



Thanks, it took time before I updated my reply to prevous answers.
I didn't see these before I did.

[I'm not that dumb] :winks:


Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:23:23 UTC, Jonathan M Davis 
wrote:

As I said in my previous response, read this article:

https://dlang.org/articles/d-array-article.html


Sorry, I didn't see this before I replied.
Had I, I wouldn't have done that.


string sv = "some string";
then _zero_ heap allocations take place.


I think u've answered my question.


C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn

On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote:
What is the equivalent of C++17 std::string_view (an object 
that can refer to a constant contiguous sequence of char-like 
objects with the first element of the sequence at position 
zero) in D?


PS: I'm getting back to D after years (since DMD 1 days). A lot 
changes since v1.0.


Wow! Thanks guys.
Those are handy, but I specifically want to do something like:

```
string_view sv = "some string";
```
So I can query it's size, make it point to sth else, use it in 
callbacks etc. Of course I'm aware of scoping etc...


I'm NOT doing any dynamic allocations, I just want a situation 
where a string allocation string would be a little bit expensive.



[I believe I still have to study D more in that case to come up 
with sth better, enjoying my ride so far]


C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
What is the equivalent of C++17 std::string_view (an object that 
can refer to a constant contiguous sequence of char-like objects 
with the first element of the sequence at position zero) in D?


PS: I'm getting back to D after years (since DMD 1 days). A lot 
changes since v1.0.