Why are non-collision-resistant hash functions considered insecure for signatures

Let we have a hash function that is second preimage resistant but not collision-resistant.

Then an adversary can create a pair of different messages M and M’, M is benign and M’ is malicious, for both of which the signature will be valid.

I don’t understand why it is an issue in the setting where signatures are used to authenticate origin of data created by the same entity. So if one signs some software he claims “I have created this content myself, if it contains malware, blame me”. And for keys: “this public key has a corresponding private key, I have access to it”.

If one crafts a collision and signs self-generated data … he still claims the above statements.

So should such hash functions be considered secure for things like self-signed certificates and code signing?

Which algorithm would be better to integrate “step” like functions

I have a function f[wr], in which the appearance is step like, first of all, the NIntegrate function is not handling this function, so I decided to do the integration algorithm by hand.

enter image description here

Without joined in plot

I have tried to integrate f[wr] using Riemann’s sum

data[mu_] :=   Module[{Te = 300., sum = 0., sum1 = 0., kb = 8.61*10^-5, a},    Do[    sum = sum + (f[wr] 0.01);     sum1 = sum1 + (f[wr] (wr - mu) 0.01);, {wr, mu - 30 kb Te,      mu + 30 kb Te, 0.01}]; sum1/(Te*sum)] 

and then, evaluate it with

Table[{data[mu],{mu,-1,1}] 

I think the results could be better if I try other algorithm. Could you suggest one?

edit: f[wr] algorithm https://pastebin.com/tfbGmhDa

How to pass objects between functions in PnP PowerShell

I have to functions. In the first, I create a reference to a SharePoint list. I would like to pass the list to a second function. In the second functions list of parameters, I declare it as String

This doesn’t work. How do I declare the parameter as being a list?

function GetList() {     param(     [string] $  listID,     [string] $  listName     )     Write-Host "Provided ListName: " $  listName -ForegroundColor Cyan     Write-Host "The list id is: " $  listID -ForegroundColor Red      $  list = Get-PnPList -Identity $  listName       CreateView -list $  list  }  function CreateView()  {     param(     [string] $  list     )      Add-PnpView -Title "Test View" -List $  list -Fields "Title"     Write-Host "Creating New View" } 

multiple functions with same filter

I want to use the same filter hook in different locations, and I just want to make sure this is OK to do so ( preliminary test shows it works, but I am not 100% sure it is OK to do so).

So the add_filter(‘check_powers’, …. ) is in one location only ( not that it matters)

function define_user_powers() {   if ( user_is_powerful() ){     add_filter('check_powers', 'give_super_power');   } }  function give_super_power( $  powers ){   $  powers = true;   return $  powers; } 

But the apply_filters(‘check_powers’) is in several locations:

function kick_ass() {   $  powers = apply_filters('check_powers', false );   if ( $  powers ) {    do_smthng();   }  }  function fly() {   $  powers = apply_filters('check_powers', false );   if ( $  powers ) {    do_smthng_else();   } } 

All questions i have found relates to the other way around ( multiple add_filter to same hook).

Plotting Integral of Exponential functions

I am trying to Plot an integral equation that involves exponential function. My code is as follow,

L[\[Alpha]_] :=    NIntegrate[    1/(k + I*0.1) (     Exp[I*k*x] (Exp[Sqrt[k^2 + \[Alpha]/w^2]*w] - 1) (Exp[k*w] - 1 +         I*0.1) Sqrt[      k^2 + \[Alpha]/       w^2])/((Sqrt[k^2 + \[Alpha]/w^2] + k) (Exp[         Sqrt[k^2 + \[Alpha]/w^2]*w - Exp[k*w]]) + (Sqrt[         k^2 + \[Alpha]/w^2] -          k) (Exp[(k + Sqrt[k^2 + \[Alpha]/w^2]) w] -          1)), {k, -100, 100}]; Plot[{Re[L[10]], Re[L[100]], Re[L[500]]}, {x, -0.45, 0.45},   PlotRange -> Full].  

But this integral gives a lot of oscillations which it should not. This is fig 2 in this article “https://arxiv.org/pdf/1508.00836.pdf” that I am trying to plot. Any help will be highly appreciated.

How can we convert between a program using `call/cc` and a program using functions written in CPS?

The Scheme Programming Language says

It turns out that any program that uses call/cc can be rewritten in CPS without call/cc, but a total rewrite of the program (sometimes including even system-defined primitives) might be necessary.

What are the general techniques to

  • convert a program using call/cc to a program using functions written in CPS

  • convert in the reverse direction?

C++ How to build a common interface with the possibility to call functions specific to only one class

I am building a common interface for several different backends that are shared libs loaded at runtime dependend on the used platform. It looks basically like the code below. My problem is, that while 90% of the functions of all backends are the same (just different implementations but same purpose) some of them have features that are not available to other platforms at all.

If I had a wrapper function for all features than they would run into the void for backends that do not support them which I want to avoid. I also don’t like the idea of having implementations of backend functions that just return errors.

What would be a good way to have a generic common interface while still being able to call functions specific to a backend if the user wants to limit his application to that platform?

class CommonInterface {     void DoA(); // Calls InternalDoA() of loaded backend      void DoB(); // Calls InternalDoB() of loaded backend      void DoC(); // Calls InternalDoC() of loaded backend ??? };  class BackendOne {     void InternalDoA();      void InternalDoB();      // DoC does not exist! };  class BackendTwo {     void InternalDoA();      void InternalDoB();      void InternalDoC(); }; 

Thanks a lot in advance!

Should one-line functions be avoided in jQuery/JavaScript?

So, I had a coworker complain about how I made the following code:

... var foo = getKendoDropdown(window.foo); var bar = getKendoDropdown(window.foo); var sna = getKendoDropdown(window.sna); var fu = getKendoDropdown(window.fu); ... function getKendoDropdownList(controlId) {     return $  ('#' + controlId).data("kendoDropDownList") } 

He said that there’s no need to make a one-line function when using jQuery, and said I should use the following instead:

... var foo = $  ('#' + window.foo).data("kendoDropDownList"); var bar = $  ('#' + window.bar).data("kendoDropDownList"); var sna = $  ('#' + window.sna).data("kendoDropDownList"); var fu = $  ('#' + window.fu).data("kendoDropDownList"); ... 

However, I know that if I came across the following in C#:

... var redFord = cars.Where(x => x.Name = "Ford").First(x => x.Colour = "Red"); var redToyota = cars.Where(x => x.Brand = "Toyota").First(x => x.Colour = "Red"); ... 

…I would tell whoever wrote it that they should stop repeating code and put the WET code into a method:

public static Car FindTheMatchingRed(this IEnumerable<Car> cars, string brand) =>     cars.Where(x => x.Brand == brand).First(x => x.Colour = "Red"); 

So, is my coworker correct? If so, why? What makes JavaScript/jQuery different such that in this case DRY does not apply?

Access a document in SharePoint library from Azure functions

I am relatively new in Microsoft’s world. I started on it three months ago and I have a doubt about the connection between SharePoint online (specifically, with libraries and lists), Microsoft Flow and Azure functions.

What I am doing is:

  1. I insert a PDF file inside a SharePoint online library.
  2. A Flow starts and I send the CONTENT of that PDF file (a text one, not an image that needs OCR treatment) to an Azure function.
  3. I try to read that content but it’s impossible for me.
  4. And finally, send specific parts of the content to the FLOW and then to another SharePoint online list.

So, I have two questions:

  1. Is it possible to pass and read the content of a PDF file to an Azure functions? And, if it’s possible, what do you recommend me to use (e.g. C# with X library, or JavaScript with X module)

  2. Is there any other options to do what I want to do? I think that it could be better if I pass the SharePoint online path of the PDF file to Azure functions and then start to work with the path (because, presumably, the Azure function knows that, in that path, there is a PDF file) but I don’t know if I could do that. Obviously, if it possible, can you recommend me anything?

That’s all.

Thank you so much and sorry for my English.

Best regards,

Carlos.